/* ==========================================================================
   Martinho Carvalho — site pessoal
   ========================================================================== */

/* Fontes auto-alojadas (sem pedidos a terceiros) — SIL Open Font License 1.1 */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-var.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens (escuro por omissão) ---------- */
:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 1160px;
  --gutter: clamp(1.1rem, 4vw, 2rem);
  --header-h: 68px;
  --radius: 20px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  color-scheme: dark;
  --bg: #060912;
  --bg-2: #0a0f1d;
  --surface: #0d1424;
  --surface-2: #121b30;
  --border: rgba(148, 178, 255, .11);
  --border-strong: rgba(148, 178, 255, .22);
  --text: #e8eefc;
  --text-2: #c3cde4;
  --muted: #8e9bb8;
  --accent: #4da3ff;
  --accent-2: #6ee7f9;
  --ok: #34d399;
  --grad: linear-gradient(100deg, #4da3ff 0%, #6ee7f9 100%);
  --on-accent: #03101f;
  --chip-bg: rgba(77, 163, 255, .08);
  --chip-text: #bcd7ff;
  --hover: rgba(148, 178, 255, .08);
  --grid-line: rgba(148, 178, 255, .07);
  --glow-1: rgba(77, 163, 255, .22);
  --glow-2: rgba(110, 231, 249, .12);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .7);
  --shadow-sm: 0 10px 30px -12px rgba(0, 0, 0, .6);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f8fc;
  --bg-2: #edf1f9;
  --surface: #ffffff;
  --surface-2: #f3f6fc;
  --border: rgba(15, 35, 80, .1);
  --border-strong: rgba(15, 35, 80, .2);
  --text: #0b1220;
  --text-2: #26324a;
  --muted: #55627c;
  --accent: #1d6fe0;
  --accent-2: #0b7f95;
  --ok: #059669;
  --grad: linear-gradient(100deg, #1d6fe0 0%, #0b7f95 100%);
  --on-accent: #ffffff;
  --chip-bg: rgba(29, 111, 224, .07);
  --chip-text: #1b4f9c;
  --hover: rgba(15, 35, 80, .06);
  --grid-line: rgba(15, 35, 80, .06);
  --glow-1: rgba(29, 111, 224, .14);
  --glow-2: rgba(11, 127, 149, .1);
  --shadow: 0 24px 50px -28px rgba(15, 35, 80, .35);
  --shadow-sm: 0 10px 24px -14px rgba(15, 35, 80, .3);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overflow-x: clip;
  transition: background-color .35s ease, color .35s ease;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
p, ul, ol, dl, dd, figure, blockquote { margin: 0; }
:where(ul[role="list"], ol[role="list"]) { list-style: none; padding: 0; }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
::selection { background: rgba(77, 163, 255, .35); }

.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;
}

/* ---------- Utilitários ---------- */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.section { position: relative; padding-block: clamp(4.5rem, 10vw, 7.5rem); }
.section--alt { background: var(--bg-2); }
.section-head { max-width: 760px; margin-bottom: clamp(2.2rem, 5vw, 3.5rem); }
.section-head.center { margin-inline: auto; text-align: center; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .65rem;
  font-family: var(--font-mono); font-size: .76rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
}
.eyebrow::before { content: ""; width: 26px; height: 1px; background: currentColor; opacity: .7; }

.section-title { margin-top: .9rem; font-size: clamp(2rem, 5vw, 3.3rem); text-wrap: balance; }
.lead { margin-top: 1.1rem; max-width: 62ch; font-size: clamp(1.02rem, 1.5vw, 1.14rem); color: var(--muted); }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}

.icon { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- Botões, chips e cartões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  min-height: 48px; padding: .8rem 1.35rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; line-height: 1; white-space: nowrap;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .2s, background-color .2s, color .2s;
}
.btn .icon { width: 18px; height: 18px; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--grad); color: var(--on-accent); box-shadow: 0 12px 30px -14px var(--accent); }
.btn-primary:hover { box-shadow: 0 18px 40px -14px var(--accent); }
.btn-ghost { border-color: var(--border-strong); background: color-mix(in srgb, var(--surface) 55%, transparent); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); background: var(--hover); }
.btn-sm { min-height: 40px; padding: .6rem 1rem; font-size: .88rem; }
.btn-sm .icon { width: 16px; height: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: .45rem; list-style: none; padding: 0; }
.chip {
  display: inline-flex; align-items: center; padding: .34rem .72rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--chip-bg); color: var(--chip-text);
  font-family: var(--font-mono); font-size: .74rem; line-height: 1.3; white-space: nowrap;
}

.card {
  position: relative;
  padding: clamp(1.35rem, 2.6vw, 1.9rem);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  transition: transform .35s var(--ease), border-color .35s, box-shadow .35s, background-color .35s;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }

.feature-icon {
  display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 1.25rem;
  border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.feature-icon .icon { width: 22px; height: 22px; }

.link-pill {
  display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .85rem; border-radius: 999px;
  border: 1px solid var(--border-strong); font-size: .85rem; font-weight: 500; color: var(--text-2);
  transition: border-color .2s, color .2s, background-color .2s;
}
.link-pill:hover { border-color: var(--accent); color: var(--text); background: var(--hover); }
.link-pill .icon { width: 14px; height: 14px; }

.more-link { margin-top: 1.8rem; }
.more-link a { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--accent); }
.more-link a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Cabeçalho ---------- */
.skip-link {
  position: fixed; top: .75rem; left: .75rem; z-index: 100; padding: .65rem 1rem; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-weight: 600;
  transform: translateY(-160%); transition: transform .2s;
}
.skip-link:focus { transform: none; }

.site-header {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition: background-color .3s, border-color .3s;
}
.site-header.is-scrolled,
.menu-open .site-header {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom-color: var(--border);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 1rem; }

.brand { display: inline-flex; align-items: center; gap: .7rem; margin-right: auto; font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: var(--grad); color: var(--on-accent); font-size: .92rem; letter-spacing: -.02em;
}
.brand-name { font-size: 1.02rem; }

.nav { display: flex; align-items: center; gap: .15rem; }
.nav a {
  padding: .5rem .8rem; border-radius: 999px; font-size: .9rem; font-weight: 500; color: var(--muted);
  transition: color .2s, background-color .2s;
}
.nav a:hover, .nav a.is-active { color: var(--text); background: var(--hover); }

.header-actions { display: flex; align-items: center; gap: .4rem; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
  min-width: 40px; height: 40px; padding: 0 .65rem; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text);
  transition: border-color .2s, background-color .2s;
}
.icon-btn:hover { border-color: var(--border-strong); background: var(--hover); }
.icon-btn .icon { width: 18px; height: 18px; }
.lang-btn { font-family: var(--font-mono); font-size: .76rem; font-weight: 500; letter-spacing: .06em; }
.lang-btn span { color: var(--muted); transition: color .2s; }
.lang-btn span.is-active { color: var(--accent); }
.lang-btn .sep { opacity: .5; }

.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

.burger { display: none; }
.burger .icon-close { display: none; }
.burger[aria-expanded="true"] .icon-menu { display: none; }
.burger[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 980px) {
  .burger { display: inline-flex; }
  .nav {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: .2rem;
    padding: .8rem var(--gutter) 1.4rem;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(-10px);
    transition: opacity .25s, transform .25s var(--ease), visibility .25s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav a { padding: .85rem 1rem; font-size: 1.05rem; border-radius: 12px; }
}
@media (max-width: 420px) {
  /* escondido visualmente, mas continua a dar nome acessível ao link */
  .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  min-height: 100vh; min-height: 100svh;
  padding: calc(var(--header-h) + clamp(2rem, 6vw, 4rem)) 0 clamp(2.5rem, 5vw, 3.5rem);
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60rem 38rem at 8% -8%, var(--glow-1), transparent 62%),
    radial-gradient(48rem 34rem at 100% 35%, var(--glow-2), transparent 62%);
}
.hero-bg::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 35%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 35%, #000 25%, transparent 75%);
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: clamp(2.5rem, 5vw, 4.5rem); align-items: center; }

.hero-id { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.8rem; }
.avatar {
  width: 80px; height: 80px; flex: none; border-radius: 50%; object-fit: cover;
  padding: 3px; background: var(--grad); box-shadow: 0 10px 30px -10px var(--accent);
}
.hero-id-text { display: grid; gap: .45rem; justify-items: start; }
.status-pill {
  display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .75rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  font-size: .8rem; font-weight: 500; color: var(--text);
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2.2s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); }
  75%, 100% { box-shadow: 0 0 0 9px transparent; }
}
.hero-role { font-family: var(--font-mono); font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

.hero-title {
  display: flex; flex-direction: column;
  font-size: clamp(3rem, 8.6vw, 7.2rem); line-height: .9; letter-spacing: -.045em; text-transform: uppercase;
}
.hero-title .grad-text { padding-bottom: .05em; }
.hero-sub { margin-top: 1.6rem; max-width: 50ch; font-size: clamp(1.05rem, 1.7vw, 1.22rem); color: var(--muted); }
.hero-sub strong { color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; margin-top: 2rem; font-size: .9rem; color: var(--muted); }
.hero-meta li { display: inline-flex; align-items: center; gap: .45rem; }
.hero-meta .icon { color: var(--accent); }

/* Terminal (sempre escuro) */
.hero-visual { position: relative; }
.terminal {
  position: relative; overflow: hidden; border-radius: 16px;
  border: 1px solid rgba(148, 178, 255, .22);
  background: linear-gradient(180deg, #0c1427 0%, #080e1c 100%);
  box-shadow: 0 40px 90px -35px rgba(0, 0, 0, .75), 0 0 120px -40px rgba(77, 163, 255, .45);
  color: #dbe6ff; font-family: var(--font-mono); font-size: clamp(.7rem, 1.05vw, .84rem);
}
.terminal-bar { display: flex; align-items: center; gap: .45rem; padding: .8rem 1rem; border-bottom: 1px solid rgba(148, 178, 255, .12); background: rgba(255, 255, 255, .02); }
.terminal-bar i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.terminal-bar i:nth-child(2) { background: #febc2e; }
.terminal-bar i:nth-child(3) { background: #28c840; }
.terminal-title { margin-left: .6rem; font-size: .74rem; color: #7d8bab; }
.terminal-body { padding: 1.15rem 1.25rem 1.35rem; overflow-x: auto; }
.t-line {
  min-height: 1.9em; line-height: 1.9; white-space: pre;
  opacity: 0; transform: translateY(4px);
  animation: term-in .45s var(--ease) forwards;
  animation-delay: calc(var(--i) * .55s + .6s);
}
@keyframes term-in { to { opacity: 1; transform: none; } }
.t-p { color: #6ee7f9; }
.t-c { color: #e8eefc; }
.t-s { color: #f9d38a; }
.t-a { color: #7cb8ff; }
.t-k { color: #c4b5fd; }
.t-ok { color: #4ade80; }
.t-w { color: #fbbf24; }
.t-m { color: #7d8bab; }
.cursor { display: inline-block; width: .6em; height: 1.15em; vertical-align: -.22em; background: #6ee7f9; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.float-chip {
  position: absolute; z-index: 2; padding: .45rem .8rem; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm); font-family: var(--font-mono); font-size: .74rem; color: var(--text);
  animation: float 7s ease-in-out infinite, fade-in .8s ease 1s backwards;
}
.float-chip--1 { top: -1.1rem; right: 10%; }
.float-chip--2 { bottom: -1.1rem; left: 8%; animation-delay: -2.3s, 1.2s; }
.float-chip--3 { top: 46%; right: -1.2rem; animation-delay: -4.6s, 1.4s; }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
@keyframes fade-in { from { opacity: 0; } }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-title { font-size: clamp(3rem, 14.5vw, 6.5rem); }
  .hero-visual { max-width: 560px; margin-top: .5rem; }
}
@media (max-width: 560px) {
  .float-chip--3 { display: none; }
  .avatar { width: 68px; height: 68px; }
}

/* ---------- Números ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(3rem, 7vw, 5rem);
  border: 1px solid var(--border); border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.stat { padding: clamp(1.1rem, 2.4vw, 1.6rem) clamp(1.1rem, 2.4vw, 1.7rem); border-left: 1px solid var(--border); }
.stat:first-child { border-left: 0; }
.stat strong {
  display: block; font-family: var(--font-display); font-size: clamp(2.2rem, 4.4vw, 3.2rem); font-weight: 700;
  line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
.stat > span { display: block; margin-top: .55rem; font-size: .9rem; line-height: 1.45; color: var(--muted); }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--border); }
}

/* ---------- Sobre ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.prose { display: grid; gap: 1.15rem; max-width: 64ch; font-size: clamp(1rem, 1.4vw, 1.08rem); color: var(--muted); }
.prose strong { color: var(--text); }
.about-side { display: grid; gap: 1.1rem; }
.quote-card { overflow: hidden; background: radial-gradient(28rem 14rem at 0% 0%, var(--glow-1), transparent 70%), var(--surface); }
.quote-mark { display: block; height: 2.4rem; font-family: Georgia, "Times New Roman", serif; font-size: 4.6rem; line-height: 1; color: var(--accent); }
.quote-card blockquote { margin-top: .6rem; font-family: var(--font-display); font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 600; line-height: 1.25; letter-spacing: -.015em; }
.quote-card figcaption { margin-top: 1.2rem; font-size: .88rem; }
.quote-card figcaption a { display: inline-flex; align-items: center; gap: .35rem; font-weight: 500; color: var(--accent); }
.quote-card figcaption a:hover { text-decoration: underline; text-underline-offset: 3px; }
.facts { padding: .4rem 1.4rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.facts div, .kv div { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px dashed var(--border); }
.facts div:last-child, .kv div:last-child { border-bottom: 0; }
.facts dt, .kv dt { font-size: .9rem; color: var(--muted); }
.facts dd, .kv dd { font-size: .95rem; font-weight: 600; text-align: right; }
@media (max-width: 900px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- IA ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.feature { overflow: hidden; }
.feature::after {
  content: ""; position: absolute; right: -25%; bottom: -55%; width: 60%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--glow-1), transparent 70%); opacity: 0; transition: opacity .4s; pointer-events: none;
}
.feature:hover::after { opacity: 1; }
.feature-num { position: absolute; top: 1.5rem; right: 1.6rem; font-family: var(--font-mono); font-size: .78rem; color: var(--muted); opacity: .7; }
.feature h3 { font-size: clamp(1.15rem, 1.8vw, 1.3rem); }
.feature p { margin-top: .6rem; color: var(--muted); }
.toolkit { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem; margin-top: 2rem; }
.toolkit-label { font-family: var(--font-mono); font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 760px) { .feature-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Percurso (timeline) ---------- */
.timeline { position: relative; display: grid; gap: 1.2rem; padding-left: 2.2rem; }
.timeline::before {
  content: ""; position: absolute; top: 1rem; bottom: 1rem; left: 7px; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2) 40%, var(--border) 100%);
}
.tl-item { position: relative; }
.tl-dot { position: absolute; top: 1.9rem; left: calc(-2.2rem + 1px); width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); }
.tl-item.is-current .tl-dot { background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent); }
.tl-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.tl-date { font-family: var(--font-mono); font-size: .8rem; color: var(--accent); }
.tl-duration { color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; padding: .22rem .6rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ok) 32%, transparent);
  background: color-mix(in srgb, var(--ok) 12%, transparent);
  font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ok);
}
.tl-role { margin-top: .7rem; font-size: clamp(1.2rem, 2.1vw, 1.45rem); }
.tl-focus { margin-top: .3rem; font-weight: 500; color: var(--accent-2); }
.tl-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .55rem; font-size: .92rem; color: var(--muted); }
.tl-meta strong { color: var(--text); }
.tl-summary { margin-top: .9rem; max-width: 75ch; color: var(--text-2); }
.tl-details { margin-top: .9rem; }
.tl-details summary {
  display: inline-flex; align-items: center; gap: .35rem; cursor: pointer; list-style: none;
  font-size: .9rem; font-weight: 600; color: var(--accent); border-radius: 8px;
}
.tl-details summary::-webkit-details-marker { display: none; }
.tl-details summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.tl-details .chev { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.tl-details[open] .chev { transform: rotate(180deg); }
.tl-details .when-open, .tl-details[open] .when-closed { display: none; }
.tl-details[open] .when-open { display: inline; }
.tl-bullets { display: grid; gap: .6rem; max-width: 80ch; margin-top: .9rem; padding: 0; list-style: none; color: var(--muted); }
.tl-bullets li { position: relative; padding-left: 1.35rem; }
.tl-bullets li::before {
  content: ""; position: absolute; left: .1rem; top: .62em; width: 7px; height: 7px; border-radius: 2px;
  background: var(--grad); transform: rotate(45deg);
}
.tl-bullets strong { color: var(--text); }
.tl-links { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }
.tl-card .chips { margin-top: 1.1rem; }
@media (max-width: 620px) {
  .timeline { padding-left: 1.6rem; }
  .tl-dot { left: calc(-1.6rem + 1px); }
}

/* ---------- Projetos ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.project { display: flex; flex-direction: column; }
.project-kicker { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.project h3 { margin-top: .6rem; font-size: clamp(1.25rem, 2.2vw, 1.5rem); }
.project-text { margin-top: .8rem; color: var(--muted); }
.project-highlight {
  display: inline-block; align-self: flex-start; margin-top: .9rem; padding: .35rem .8rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent);
  background: color-mix(in srgb, var(--ok) 10%, transparent);
  font-size: .85rem; color: var(--text-2);
}
.project-highlight strong { color: var(--ok); }
.project-role { margin-top: .8rem; font-size: .95rem; color: var(--text-2); }
.project .chips { margin-top: 1.2rem; }
.project-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.4rem; }

.project--featured {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); align-items: center;
  gap: clamp(1.5rem, 4vw, 3rem); overflow: hidden; padding: clamp(1.6rem, 4vw, 3rem);
  background: radial-gradient(40rem 24rem at 100% 50%, var(--glow-1), transparent 65%), var(--surface);
}
.project--featured h3 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.project--reverse { grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); background: radial-gradient(40rem 24rem at 0% 50%, var(--glow-1), transparent 65%), var(--surface); }
.project--reverse .phone { order: -1; rotate: -5deg; }

@media (max-width: 760px) {
  .projects-grid { grid-template-columns: minmax(0, 1fr); }
  .project--featured, .project--reverse { grid-template-columns: minmax(0, 1fr); }
  .project--reverse .phone { order: 0; }
}

/* Telemóvel ilustrado (decorativo, sempre escuro) */
.phone {
  position: relative; justify-self: center; width: min(230px, 62vw); aspect-ratio: 9 / 18.5;
  padding: 10px; border-radius: 38px; rotate: 5deg;
  background: linear-gradient(155deg, #26304a, #0b1020 60%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), 0 40px 70px -30px rgba(0, 0, 0, .65), 0 0 90px -30px rgba(77, 163, 255, .55);
  transition: rotate .5s var(--ease);
}
.project:hover .phone { rotate: 0deg; }
.phone-notch { position: absolute; top: 18px; left: 50%; z-index: 1; width: 72px; height: 20px; border-radius: 999px; background: #04060c; translate: -50% 0; }
.phone-screen {
  display: flex; flex-direction: column; gap: 10px; height: 100%; padding: 46px 14px 14px; overflow: hidden;
  border-radius: 29px; background: linear-gradient(180deg, #0f1b36 0%, #0a1224 100%);
}
.ph-head { display: flex; align-items: center; justify-content: space-between; }
.ph-head span:first-child { width: 46%; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .32); }
.ph-head span:last-child { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, #4da3ff, #6ee7f9); }
.ph-card { padding: 10px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .05); }
.ph-pulse svg { width: 100%; height: 70px; overflow: visible; }
.pulse-path {
  fill: none; stroke: #6ee7f9; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(110, 231, 249, .6));
}
@keyframes draw { 0% { stroke-dashoffset: 1; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -1; } }
.ph-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ph-metric b { display: block; width: 58%; height: 16px; border-radius: 5px; background: linear-gradient(90deg, #4da3ff, #6ee7f9); }
.ph-metric i { display: block; width: 82%; height: 6px; margin-top: 8px; border-radius: 3px; background: rgba(255, 255, 255, .14); }
.ph-list { display: grid; gap: 9px; }
.ph-list i { display: block; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .12); }
.ph-list i:nth-child(1) { width: 90%; }
.ph-list i:nth-child(2) { width: 68%; }
.ph-list i:nth-child(3) { width: 80%; }
.ph-list i:nth-child(4) { width: 58%; }
.ph-list--tx i { height: 9px; }
.ph-balance {
  display: grid; gap: 8px; padding: 14px; border-radius: 16px;
  background: linear-gradient(135deg, #1d6fe0, #0b7f95);
  box-shadow: 0 12px 24px -12px rgba(29, 111, 224, .8);
}
.ph-balance i { display: block; width: 40%; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .55); }
.ph-balance b { display: block; width: 72%; height: 18px; border-radius: 5px; background: rgba(255, 255, 255, .95); }
.ph-balance i:last-child { width: 55%; background: rgba(255, 255, 255, .35); }
.ph-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ph-actions span { aspect-ratio: 1; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .07); }
.ph-actions span:first-child { background: rgba(110, 231, 249, .22); }
.ph-cta { height: 34px; margin-top: auto; border-radius: 12px; background: linear-gradient(90deg, #4da3ff, #6ee7f9); }

/* Laboratório GitHub */
.lab { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.lab-head h3 { display: flex; align-items: center; gap: .6rem; font-size: 1.25rem; }
.lab-head h3 .icon { width: 22px; height: 22px; }
.lab-head p { margin-top: .4rem; color: var(--muted); }
.lab-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; margin-top: 1.3rem; }
.repo {
  display: flex; flex-direction: column; gap: .45rem; height: 100%; padding: 1.1rem 1.2rem;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
  transition: border-color .25s, transform .25s var(--ease);
}
.repo:hover { border-color: var(--accent); transform: translateY(-3px); }
.repo-name { font-family: var(--font-mono); font-size: .86rem; font-weight: 600; color: var(--accent); word-break: break-word; }
.repo-text { flex: 1; font-size: .9rem; color: var(--muted); }
.repo-lang { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--text-2); }
.repo-lang::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--lang, #8e9bb8); }
.repo-lang[data-lang-color="Dart"] { --lang: #00b4ab; }
.repo-lang[data-lang-color="Java"] { --lang: #b07219; }
.repo-lang[data-lang-color="Objective-C"] { --lang: #438eff; }
.repo-lang[data-lang-color="C#"] { --lang: #178600; }
.repo-lang[data-lang-color="C++"] { --lang: #f34b7d; }
.repo-lang[data-lang-color="Python"] { --lang: #3572a5; }
@media (max-width: 980px) { .lab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .lab-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Stack ---------- */
.stack-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem; }
.stack-card h3 { display: flex; align-items: center; gap: .65rem; font-size: 1.08rem; }
.stack-card h3 .icon { width: 20px; height: 20px; color: var(--accent); }
.stack-card .chips { margin-top: 1.1rem; }
@media (max-width: 980px) { .stack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .stack-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Artigos ---------- */
.posts { display: grid; gap: 1.1rem; }
.post { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); padding: 0; overflow: hidden; }
.post-media { overflow: hidden; background: #050913; }
.post-media img { width: 100%; height: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform .6s var(--ease); }
.post:hover .post-media img { transform: scale(1.03); }
.post-body { display: flex; flex-direction: column; justify-content: center; padding: clamp(1.4rem, 3vw, 2.4rem); }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }
.post h3 { margin-top: .9rem; font-size: clamp(1.25rem, 2.3vw, 1.65rem); line-height: 1.2; }
.post-excerpt { margin-top: .8rem; color: var(--muted); }
.post-cta { display: inline-flex; align-items: center; gap: .4rem; margin-top: 1.4rem; font-weight: 600; color: var(--accent); }
@media (max-width: 860px) { .post { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Formação ---------- */
.edu-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.edu-kicker { font-family: var(--font-mono); font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.edu-card h3 { margin-top: .5rem; font-size: 1.15rem; line-height: 1.25; }
.edu-period { margin-top: .45rem; font-family: var(--font-mono); font-size: .8rem; color: var(--accent); }
.edu-card > p:not(.edu-kicker):not(.edu-period):not(.edu-highlight) { margin-top: .7rem; color: var(--muted); }
.edu-highlight { margin-top: 1rem; padding: .85rem 1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--chip-bg); font-size: .95rem; color: var(--text-2); }
.edu-highlight strong { color: var(--text); }
.kv { margin-top: .6rem; }
@media (max-width: 980px) {
  .edu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .edu-card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 620px) {
  .edu-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Contacto e rodapé ---------- */
.section--contact { padding-top: clamp(2rem, 5vw, 4rem); }
.contact-card {
  position: relative; overflow: hidden; text-align: center;
  padding: clamp(2.6rem, 7vw, 5rem) clamp(1.4rem, 5vw, 4rem);
  border: 1px solid var(--border-strong); border-radius: 28px;
  background:
    radial-gradient(40rem 20rem at 50% -25%, var(--glow-1), transparent 70%),
    radial-gradient(30rem 18rem at 100% 120%, var(--glow-2), transparent 70%),
    var(--surface);
}
.contact-card .eyebrow::after { content: ""; width: 26px; height: 1px; background: currentColor; opacity: .7; }
.contact-card .section-title { font-size: clamp(2.1rem, 6vw, 4rem); }
.contact-text { max-width: 54ch; margin: 1.1rem auto 0; font-size: clamp(1rem, 1.6vw, 1.12rem); color: var(--muted); }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; margin-top: 2.2rem; }
.contact-mail { margin-top: 1.2rem; font-family: var(--font-mono); font-size: .85rem; color: var(--muted); }

.site-footer { padding: 2rem 0 2.4rem; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1.5rem; }
.back-top { display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; color: var(--text-2); }
.back-top:hover { color: var(--accent); }

.noscript { max-width: 640px; margin: 0 auto; padding: 8rem 1.5rem; text-align: center; }
.noscript h1 { font-size: 2.5rem; }
.noscript p { margin-top: 1rem; color: var(--muted); }
.noscript a { color: var(--accent); }

/* ---------- Animações de entrada ---------- */
.js .reveal:not(.is-visible) { opacity: 0; }
.js .reveal.is-visible { animation: reveal-in .9s var(--ease) var(--d, 0s) backwards; }
.js .reveal.is-instant { animation: none; }
@keyframes reveal-in { from { opacity: 0; translate: 0 26px; } to { opacity: 1; translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- Impressão / CV em PDF ---------- */
@media print {
  :root, [data-theme] {
    --bg: #fff; --bg-2: #fff; --surface: #fff; --text: #111; --text-2: #222; --muted: #444;
    --border: #ddd; --border-strong: #ccc; --accent: #1d4ed8; --accent-2: #0e7490;
    --chip-bg: #f3f4f6; --chip-text: #111; --grad: linear-gradient(#1d4ed8, #1d4ed8);
  }
  @page { margin: 14mm; }
  body { background: #fff; font-size: 10.5pt; }
  .site-header, .skip-link, .hero-visual, .hero-bg, .hero-actions, .contact-actions, .more-link,
  .phone, .back-top, .tl-details summary, .lab, .post-media, .feature::after, noscript { display: none !important; }
  .hero { min-height: 0; padding: 0 0 1rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.6rem; }
  .section { padding-block: 1.2rem; }
  .section--alt { background: none; }
  .section-title { font-size: 1.6rem; }
  .card, .stats, .facts { box-shadow: none !important; transform: none !important; break-inside: avoid; }
  .card { padding: 1rem; }
  .project--featured, .project--reverse, .post { grid-template-columns: 1fr; background: #fff; }
  .js .reveal { opacity: 1 !important; animation: none !important; }
  .grad-text, .stat strong { background: none; color: var(--accent); -webkit-text-fill-color: currentColor; }
  .t-line { animation: none; opacity: 1; }
}
