/* ============================================================
   ESTILO TIPOGRÁFICO — inspirado em darioamodei.com
   Edite as variáveis abaixo para personalizar cores e fontes.
   ============================================================ */

:root {
  --color-text: #1a1a1a;
  --color-text-muted: #6b6b6b;
  --color-link: #1a1a1a;
  --color-link-hover: #8b6914;
  --color-bg: #fafaf7;
  --color-bg-soft: #f3f1ea;
  --color-border: #e5e5e0;
  --color-accent: #8b6914;
  --color-code-bg: #f0ede4;

  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --content-width: 680px;
  --wide-width: 860px;

  --transition-theme: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

[data-theme="dark"] {
  --color-text: #e8e6df;
  --color-text-muted: #c7c7c7;
  --color-link: #e8e6df;
  --color-link-hover: #d4a84a;
  --color-bg: #14130f;
  --color-bg-soft: #1e1c17;
  --color-border: #2a2822;
  --color-accent: #d4a84a;
  --color-code-bg: #232119;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  padding: 60px 24px 120px;
  transition: var(--transition-theme);
}

/* --------- LAYOUT --------- */

.container {
  max-width: var(--content-width);
  margin: 0 auto;
}

.container-wide {
  max-width: var(--wide-width);
  margin: 0 auto;
}

/* --------- CABEÇALHO / NAVEGAÇÃO --------- */

.site-header {
  max-width: var(--content-width);
  margin: 0 auto 80px;
  display: flex;
  align-items: baseline;
  gap: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border);
}

.site-title {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-title a {
  color: var(--color-text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.site-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 16px;
  transition: color 0.15s ease;
}

.site-nav a:hover {
  color: var(--color-accent);
}

/* --------- BIOGRAFIA --------- */

.bio {
  margin-bottom: 56px;
  font-size: 19px;
  line-height: 1.7;
  color: var(--color-text);
}

.bio p {
  margin-bottom: 1em;
}

.bio-placeholder {
  padding: 24px;
  background: var(--color-bg-soft);
  border-left: 3px solid var(--color-accent);
  
  color: var(--color-text-muted);
  font-size: 17px;
  line-height: 1.6;
}

/* Texto de apresentação definitivo — estilo limpo, sem fundo destacado */
.bio-text {
  font-size: 19px;
  line-height: 1.7;
  color: var(--color-text);
}

.bio-text p {
  margin-bottom: 1em;
}

.bio-text p:last-child {
  margin-bottom: 0;
}

/* Apresentação em blockquote — mesma estética das citações dos estudos */
.bio-quote {
  margin: 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--color-accent);
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 17px;
  line-height: 1.65;
}

.bio-quote p {
  margin-bottom: 0.7em;
}

.bio-quote p:last-child {
  margin-bottom: 0;
}

/* --------- LISTAS DE TEXTOS (seções) --------- */

.section {
  margin-bottom: 56px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 20px;
  color: var(--color-text);
}

/* Quando o título da seção é um link — mantém a aparência de título,
   mas ganha indicação sutil de que é clicável ao passar o mouse. */
.section-title a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.section-title a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.section-title a .info-icon {
  width: 13px;
  height: 13px;
  opacity: 0.4;
  transition: opacity 0.15s ease;
}

.section-title a:hover .info-icon {
  opacity: 1;
}

.post-list {
  list-style: none;
}

.post-list li {
  margin-bottom: 12px;
  line-height: 1.5;
}

.post-list a {
  color: var(--color-link);
  text-decoration: none;
  font-size: 19px;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.post-list a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.post-meta {
  display: inline;
  color: var(--color-text-muted);
  font-size: 15px;
  margin-left: 6px;
}

/* --------- PÁGINA DE ENSAIO / POST --------- */

.essay-header {
  margin-bottom: 48px;
}

.essay-title {
  font-family: var(--font-serif);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 16px;
  color: var(--color-text);
}

.essay-subtitle {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.4;
  margin-bottom: 16px;
  font-style: italic;
}

.essay-date {
  font-size: 16px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.essay-body {
  font-size: 19px;
  line-height: 1.7;
}

.essay-body p {
  margin-bottom: 1.2em;
}

.essay-body h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 2.2em;
  margin-bottom: 0.8em;
  letter-spacing: -0.01em;
}

.essay-body h3 {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.35;
  margin-top: 1.8em;
  margin-bottom: 0.6em;
}

.essay-body a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--color-border);
  transition: text-decoration-color 0.15s ease;
}

.essay-body a:hover {
  text-decoration-color: var(--color-accent);
  color: var(--color-accent);
}

.essay-body blockquote {
  margin: 1.5em 0;
  padding: 4px 0 4px 24px;
  border-left: 3px solid var(--color-accent);
  color: var(--color-text-muted);
  font-style: italic;
}

.essay-body blockquote p {
  margin-bottom: 0.6em;
}

.essay-body blockquote p:last-child {
  margin-bottom: 0;
}

.essay-body ul,
.essay-body ol {
  margin: 1.2em 0;
  padding-left: 1.6em;
}

.essay-body li {
  margin-bottom: 0.4em;
}

.essay-body strong {
  font-weight: 600;
}

.essay-body em {
  font-style: italic;
}

.essay-body hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 3em auto;
  width: 80px;
}

.essay-body code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--color-code-bg);
  padding: 2px 5px;
  border-radius: 3px;
}

/* --------- TABELAS (estudos) --------- */

.essay-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.8em 0;
  font-size: 15px;
  line-height: 1.5;
  font-family: var(--font-sans);
}

.essay-body thead {
  border-bottom: 2px solid var(--color-border);
}

.essay-body th {
  text-align: left;
  font-weight: 600;
  padding: 10px 12px 10px 0;
  color: var(--color-text);
  vertical-align: bottom;
}

.essay-body td {
  padding: 10px 12px 10px 0;
  vertical-align: top;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.essay-body tbody tr:last-child td {
  border-bottom: none;
}

/* Segunda coluna (Código) — não quebrar em duas linhas */
.essay-body th:nth-child(2),
.essay-body td:nth-child(2) {
  white-space: nowrap;
}

.essay-body td em,
.essay-body th em {
  font-style: italic;
  color: var(--color-text-muted);
}

/* Para tabelas largas: permite rolar horizontalmente em mobile sem quebrar layout */
.table-wrapper {
  overflow-x: auto;
  margin: 1.8em 0;
}

.table-wrapper table {
  margin: 0;
  min-width: 480px;
}

/* --------- LIVRO (sumário + seções) --------- */

.toc {
  background: var(--color-bg-soft);
  padding: 28px 32px;
  margin-bottom: 60px;
  border-radius: 4px;
}

.toc h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 18px 0;
  text-transform: none;
  letter-spacing: 0;
  color: var(--color-text);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc-counter;
}

.toc-list li {
  counter-increment: toc-counter;
  margin-bottom: 8px;
  padding-left: 32px;
  position: relative;
  line-height: 1.5;
}

.toc-list li::before {
  content: counter(toc-counter, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.toc-list a {
  color: var(--color-text);
  text-decoration: none;
  font-size: 17px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.toc-list a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

.book-section {
  margin-top: 3.5em;
  padding-top: 2em;
  border-top: 1px solid var(--color-border);
  scroll-margin-top: 30px;
}

.book-section:first-of-type {
  border-top: none;
}

.book-section h2 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  margin-top: 0.3em;
  margin-bottom: 1em;
  letter-spacing: -0.01em;
}

.back-to-toc {
  margin-top: 2.5em;
  text-align: center;
  font-size: 14px;
}

.back-to-toc a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-family: var(--font-sans);
  transition: color 0.15s ease;
}

.back-to-toc a:hover {
  color: var(--color-accent);
}

/* Referência de nota de rodapé no corpo — número pequeno em superscript */
.footnote-ref a {
  text-decoration: none;
  color: var(--color-accent);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.75em;
  padding: 0 2px;
}

.footnote-ref a:hover {
  text-decoration: underline;
}

/* Setinha "voltar ao texto" dentro da nota */
.footnote-back {
  text-decoration: none;
  color: var(--color-text-muted);
  margin-left: 4px;
  font-size: 0.9em;
}

.footnote-back:hover {
  color: var(--color-accent);
}

/* Quando uma nota é destino de link (#fn-N) — não encostar no topo da tela */
.footnotes li[id^="fn-"] {
  scroll-margin-top: 30px;
}

/* --------- RODAPÉ --------- */

.site-footer {
  max-width: var(--content-width);
  margin: 100px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
  font-size: 15px;
  color: var(--color-text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--color-accent);
}

/* --------- NAVEGAÇÃO ENTRE PÁGINAS (voltar) --------- */

.back-link {
  display: inline-block;
  margin-bottom: 40px;
  font-size: 16px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--color-accent);
}

.back-link::before {
  content: "← ";
}

/* --------- COMENTÁRIOS / NOTAS DE RODAPÉ --------- */

.footnotes {
  margin-top: 4em;
  padding-top: 2em;
  border-top: 1px solid var(--color-border);
  font-size: 16px;
  color: var(--color-text-muted);
  line-height: 1.55;
}

.footnotes h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--color-text);
}

.footnotes ol {
  padding-left: 1.4em;
}

.footnotes li {
  margin-bottom: 0.5em;
}

/* --------- MARCA DE "PREENCHER" --------- */

.placeholder {
  background: var(--color-bg-soft);
  border-left: 3px dashed var(--color-accent);
  padding: 14px 20px;
  margin: 1.2em 0;
  font-style: italic;
  color: var(--color-text-muted);
  font-size: 17px;
}

.placeholder::before {
  content: "✎ ";
  font-style: normal;
  color: var(--color-accent);
}

/* --------- BOTÃO DE TEMA (claro / escuro) --------- */

.theme-toggle {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: var(--transition-theme), transform 0.15s ease;
  font-family: inherit;
  line-height: 1;
}

.theme-toggle:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

/* Mostra só um ícone por vez, conforme o tema */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }

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

/* --------- RESPONSIVO --------- */

@media (max-width: 720px) {
  body {
    padding: 32px 20px 80px;
    font-size: 18px;
  }

  .site-header {
    margin-bottom: 56px;
    flex-wrap: wrap;
    gap: 16px;
  }

  .site-nav {
    margin-left: 0;
    gap: 16px;
  }

  .essay-title {
    font-size: 32px;
  }

  .essay-subtitle {
    font-size: 19px;
  }

  .essay-body,
  .bio {
    font-size: 18px;
  }
}

/* --------- FONTES (Google Fonts) --------- */
/* Importado via <link> no <head> de cada HTML */
