/* ============================================================
   Cores e variáveis — troque aqui para mudar o visual
   ============================================================ */
:root {
  --bg: #0f1115;
  --bg-alt: #141720;
  --surface: #1b1f2a;
  --text: #e8eaf0;
  --muted: #9aa3b5;
  --border: #2a2f3d;
  --accent: #8b6cff;
  --accent-2: #22d3ee;
  --code-bg: #161a23;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .3);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  /* realce de código */
  --hl-comment: #6b7489;
  --hl-keyword: #c792ea;
  --hl-string: #a5e075;
  --hl-number: #f78c6c;
  --hl-func: #82aaff;
  --hl-tag: #ff7a90;
  --hl-attr: #ffcb6b;
}

[data-theme="light"] {
  --bg: #fafafc;
  --bg-alt: #f0f2f7;
  --surface: #ffffff;
  --text: #171a22;
  --muted: #5b6478;
  --border: #dfe3ec;
  --accent: #6d4aff;
  --accent-2: #0891b2;
  --code-bg: #f4f5f9;
  --shadow: 0 10px 30px rgba(20, 24, 40, .08);

  --hl-comment: #8a93a6;
  --hl-keyword: #8e44ad;
  --hl-string: #2e7d32;
  --hl-number: #d35400;
  --hl-func: #1e5bd8;
  --hl-tag: #c2185b;
  --hl-attr: #a66a00;
}

/* ============================================================
   Base
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background .3s, color .3s;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: min(1100px, 92%); margin-inline: auto; }
.container--narrow { width: min(760px, 92%); }

.skip {
  position: absolute; left: 1rem; top: -100px; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 8px;
}
.skip:focus { top: 1rem; }

/* ============================================================
   Navegação
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-color: var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.nav__logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; gap: 1.8rem; }
.nav__links a { color: var(--muted); font-weight: 500; transition: color .2s; position: relative; }
.nav__links a:hover, .nav__links a.is-active { color: var(--text); }
.nav__links a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px;
}
.nav__actions { display: flex; gap: .5rem; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); font-size: 1.1rem;
  transition: border-color .2s;
}
.icon-btn:hover { border-color: var(--accent); }
.nav__burger { display: none; }

/* ============================================================
   Botões e links
   ============================================================ */
.btn {
  display: inline-block; padding: .8rem 1.5rem; border-radius: 999px;
  font-weight: 600; transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn--ghost { border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--surface); }
.link-arrow { color: var(--accent); font-weight: 600; white-space: nowrap; }
.link-arrow:hover { text-decoration: underline; }

/* ============================================================
   Hero
   ============================================================ */
.hero { position: relative; padding: 7rem 0 6rem; overflow: hidden; }
.hero--small { padding: 9rem 0; }
.hero__inner { position: relative; z-index: 1; }
.eyebrow { color: var(--accent-2); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; font-size: .8rem; }
.hero__title {
  font-size: clamp(2.6rem, 8vw, 5rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.05;
  margin: .6rem 0 1rem;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__text { max-width: 580px; color: var(--muted); font-size: 1.1rem; margin-bottom: 2rem; }
.hero__cta { display: flex; gap: 1rem; flex-wrap: wrap; }
.hero__glow {
  position: absolute; width: 560px; height: 560px; right: -160px; top: -60px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 30%, transparent), transparent 65%);
  filter: blur(40px); animation: float 12s ease-in-out infinite; pointer-events: none;
}
@keyframes float { 50% { transform: translate(-50px, 50px); } }

/* ============================================================
   Seções
   ============================================================ */
.section { padding: 4.5rem 0; }
.section--alt { background: var(--bg-alt); }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1.5rem; }
.section__title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); font-weight: 800; letter-spacing: -.03em; }
.section > .container > .section__title { margin-bottom: 1.5rem; }
.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

/* Páginas internas */
.page { padding: 3.5rem 0 5rem; }
.page__header { margin-bottom: 2.5rem; }
.page__title { font-size: clamp(2.2rem, 6vw, 3.2rem); font-weight: 800; letter-spacing: -.04em; line-height: 1.1; }
.page__lead { color: var(--muted); font-size: 1.1rem; margin-top: .6rem; }

/* ============================================================
   Lista de posts
   ============================================================ */
.post-list { display: flex; flex-direction: column; gap: 1rem; }
.post-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; transition: border-color .2s, transform .2s, box-shadow .2s;
}
.post-item:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-2px); box-shadow: var(--shadow); }
.post-item.is-hidden { display: none; }
.post-item__link { display: block; }
.post-item__title { font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; margin: .3rem 0 .3rem; }
.post-item__link:hover .post-item__title { color: var(--accent); }
.post-item__desc { color: var(--muted); font-size: .97rem; }
.post-item .tags { margin-top: .8rem; }

.meta { color: var(--muted); font-size: .85rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.tag {
  font-size: .78rem; padding: .2rem .6rem; border-radius: 6px;
  background: var(--bg-alt); color: var(--muted); border: 1px solid var(--border); transition: all .2s;
}
.tag:hover { color: var(--accent); border-color: var(--accent); }

.year-group { margin-bottom: 2.5rem; }
.year-group.is-hidden { display: none; }
.year-group__title { font-size: 1rem; color: var(--muted); font-weight: 600; margin-bottom: 1rem; letter-spacing: .05em; }

/* Ferramentas do blog */
.blog-tools { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 2.5rem; }
.search {
  width: 100%; padding: .85rem 1.1rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); outline: none; transition: border-color .2s;
}
.search:focus { border-color: var(--accent); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 2rem; }
.blog-tools .filters { margin-bottom: 0; }
.filter {
  padding: .4rem 1rem; border-radius: 999px; background: transparent;
  color: var(--muted); border: 1px solid var(--border); transition: all .2s; font-size: .9rem;
}
.filter small { opacity: .6; margin-left: .2rem; }
.filter.is-active, .filter:hover { color: var(--text); border-color: var(--accent); background: var(--surface); }

/* ============================================================
   Estudando agora
   ============================================================ */
.studying { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.studying__item {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.studying__topic { font-weight: 600; }
.status { font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; background: var(--bg-alt); color: var(--muted); }
.status--estudando { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.status--concluido { background: color-mix(in srgb, #10b981 18%, transparent); color: #10b981; }
.status--na-fila { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #d48806; }

/* ============================================================
   Projetos
   ============================================================ */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.5rem; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.card.is-hidden { display: none; }
.card__thumb {
  height: 150px; display: grid; place-items: center; font-size: 3rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 30%, transparent), color-mix(in srgb, var(--c) 6%, transparent));
}
.card__body { padding: 1.3rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; }
.card__title { font-size: 1.15rem; font-weight: 700; }
.card__desc { color: var(--muted); font-size: .95rem; flex: 1; }
.card__tags { display: flex; gap: .4rem; flex-wrap: wrap; }
.card__tags span { font-size: .75rem; padding: .2rem .6rem; border-radius: 6px; background: var(--bg-alt); color: var(--muted); }
.card__links { display: flex; gap: 1rem; margin-top: .3rem; font-weight: 600; font-size: .9rem; }
.card__links a { color: var(--accent); }
.card__links a:hover { text-decoration: underline; }

/* ============================================================
   Post
   ============================================================ */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.post { padding: 3rem 0 5rem; }
.post__header { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.post__header .tags { margin-top: 1rem; }
.back { color: var(--muted); font-size: .9rem; font-weight: 500; }
.back:hover { color: var(--accent); }
.post__title { font-size: clamp(2rem, 5.5vw, 3rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.12; margin: 1rem 0 .8rem; }
.post__lead { color: var(--muted); font-size: 1.15rem; margin-bottom: 1rem; }

.toc {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.3rem; margin-bottom: 2.5rem;
}
.toc summary { font-weight: 700; cursor: pointer; }
.toc ol { margin-top: .8rem; display: flex; flex-direction: column; gap: .35rem; counter-reset: toc; }
.toc li a { color: var(--muted); font-size: .93rem; }
.toc li a:hover { color: var(--accent); }
.toc li.toc--h3 { padding-left: 1.2rem; }

.post__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.post__nav-link {
  display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.2rem;
  border: 1px solid var(--border); border-radius: 12px; transition: border-color .2s;
}
.post__nav-link:hover { border-color: var(--accent); }
.post__nav-link small { color: var(--muted); }
.post__nav-link span { font-weight: 600; }
.post__nav-link--next { text-align: right; grid-column: 2; }

/* ============================================================
   Conteúdo (markdown)
   ============================================================ */
.prose { font-size: 1.06rem; line-height: 1.8; }
.prose > * + * { margin-top: 1.25rem; }
.prose h2 { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; margin-top: 3rem; line-height: 1.3; }
.prose h3 { font-size: 1.25rem; font-weight: 700; margin-top: 2.2rem; line-height: 1.35; }
.prose h4 { font-size: 1.05rem; font-weight: 700; margin-top: 1.8rem; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: .4rem; }
.prose li::marker { color: var(--accent); }
.prose hr { border: 0; height: 1px; background: var(--border); margin: 3rem 0; }
.prose img { border-radius: 12px; border: 1px solid var(--border); margin-inline: auto; }

.prose blockquote {
  border-left: 3px solid var(--accent); padding: .8rem 1.2rem; color: var(--muted);
  background: var(--bg-alt); border-radius: 0 10px 10px 0;
}
/* Caixas de destaque: > texto   +   {: .nota } / {: .dica } / {: .atencao } */
.prose blockquote.nota, .prose blockquote.dica, .prose blockquote.atencao { color: var(--text); }
.prose blockquote.nota { border-color: #3b82f6; background: color-mix(in srgb, #3b82f6 10%, transparent); }
.prose blockquote.dica { border-color: #10b981; background: color-mix(in srgb, #10b981 10%, transparent); }
.prose blockquote.atencao { border-color: #f59e0b; background: color-mix(in srgb, #f59e0b 12%, transparent); }
.prose blockquote.nota::before { content: "ℹ️ Nota"; }
.prose blockquote.dica::before { content: "💡 Dica"; }
.prose blockquote.atencao::before { content: "⚠️ Atenção"; }
.prose blockquote[class]::before { display: block; font-weight: 700; margin-bottom: .3rem; }

.prose table { width: 100%; border-collapse: collapse; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: .6rem .9rem; text-align: left; }
.prose th { background: var(--bg-alt); font-weight: 700; }

/* Código inline */
.prose :not(pre) > code {
  font-family: var(--mono); font-size: .88em; padding: .15em .4em; border-radius: 6px;
  background: var(--code-bg); border: 1px solid var(--border);
}

/* Blocos de código */
.prose .highlighter-rouge { position: relative; }
.prose pre {
  font-family: var(--mono); font-size: .88rem; line-height: 1.65;
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 2.4rem 1.2rem 1.1rem; overflow-x: auto; tab-size: 2;
}
.code-lang {
  position: absolute; top: .55rem; left: 1rem; font-size: .7rem; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font);
}
.copy-btn {
  position: absolute; top: .45rem; right: .5rem; font-size: .75rem; padding: .25rem .6rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; color: var(--muted);
  opacity: 0; transition: opacity .2s, color .2s;
}
.highlighter-rouge:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--text); }
@media (hover: none) { .copy-btn { opacity: 1; } }

/* Realce de sintaxe (Rouge) */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .cp, .highlight .cd { color: var(--hl-comment); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kt, .highlight .kp, .highlight .kc, .highlight .ow { color: var(--hl-keyword); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .dl { color: var(--hl-string); }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .il { color: var(--hl-number); }
.highlight .nf, .highlight .fm, .highlight .nb, .highlight .bp, .highlight .nc { color: var(--hl-func); }
.highlight .nt { color: var(--hl-tag); }
.highlight .na, .highlight .nv, .highlight .vi, .highlight .py { color: var(--hl-attr); }
.highlight .o, .highlight .p { color: var(--muted); }
.highlight .gd { color: #ef4444; }
.highlight .gi { color: #10b981; }
.highlight .err { color: inherit; background: none; }

/* ============================================================
   Rodapé
   ============================================================ */
.footer { padding: 2rem 0; border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.footer__links { display: flex; align-items: center; gap: 1.2rem; }
.footer__links a:hover { color: var(--accent); }
.to-top {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border); transition: background .2s;
}
.to-top:hover { background: var(--surface); }

/* ============================================================
   Responsivo
   ============================================================ */
@media (max-width: 760px) {
  .nav__burger { display: block; }
  .nav__links {
    position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height .3s;
  }
  .nav__links.is-open { max-height: 320px; }
  .nav__links a { display: block; padding: 1rem 4%; }
  .nav__links a.is-active::after { display: none; }
  .hero { padding: 4.5rem 0 4rem; }
  .post__nav { grid-template-columns: 1fr; }
  .post__nav-link--next { grid-column: auto; }
  .section__head { flex-direction: column; gap: .3rem; }
  .prose { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
