/* ==========================================================================
   Fronteiras da Fé — CSS editorial
   Ergonomia de leitura prolongada (ensaios 2.000+ palavras)
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;0,6..72,700;1,6..72,400;1,6..72,500&display=swap");

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  --bg: #f9f8f6;
  --bg-elevated: #ffffff;
  --bg-surface: #f3f2ef;
  --text: #1c1c1a;
  --text-muted: #5c5a55;
  --border: #e5e3df;
  --accent: #1e3a5f;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--bg));
  --thesis-bg: color-mix(in srgb, var(--text) 3.5%, var(--bg));
  --focus-ring: color-mix(in srgb, var(--accent) 45%, transparent);

  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  --fs-body: 1.15rem;
  --lh-body: 1.75;
  --measure: 760px;
  --chrome-max: 760px;
  --gutter: 1.5rem;
  --rule-subtle: #e4e4e7;
  --section-kicker: #71717a;
  --meta-tone: #a1a1aa;
  --excerpt-tone: #52525b;
  --about-heading: #18181b;
  --principles-tone: #3f3f46;
  --link-manifesto: #1d4ed8;
  --hero-title: #18181b;
  --sidenote-width: 14.5rem;
  --sidenote-gap: 2rem;
  --header-height: 3.75rem;
  --radius-sm: 4px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #161618;
    --bg-elevated: #1c1c1f;
    --bg-surface: #1e1e22;
    --text: #d6d5d0;
    --text-muted: #9a9891;
    --border: #2e2e34;
    --accent: #8da4c4;
    --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--bg));
    --thesis-bg: rgba(255, 255, 255, 0.03);
    --rule-subtle: #27272a;
    --section-kicker: #71717a;
    --meta-tone: #a1a1aa;
    --excerpt-tone: #d4d4d8;
    --about-heading: #f4f4f5;
    --principles-tone: #d4d4d8;
    --link-manifesto: #93c5fd;
    --hero-title: #f4f4f5;
  }
}

html.dark-theme,
html.dark-theme:root,
body.dark-theme {
  color-scheme: dark;

  --bg: #161618;
  --bg-elevated: #1c1c1f;
  --bg-surface: #1e1e22;
  --text: #d6d5d0;
  --text-muted: #9a9891;
  --border: #2e2e34;
  --accent: #8da4c4;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, var(--bg));
  --thesis-bg: rgba(255, 255, 255, 0.03);
  --rule-subtle: #27272a;
  --section-kicker: #71717a;
  --meta-tone: #a1a1aa;
  --excerpt-tone: #d4d4d8;
  --about-heading: #f4f4f5;
  --principles-tone: #d4d4d8;
  --link-manifesto: #93c5fd;
  --hero-title: #f4f4f5;
}

/* Forçar claro quando .light-theme sobrescreve o SO */
html.light-theme,
html.light-theme:root,
body.light-theme {
  color-scheme: light;

  --bg: #f9f8f6;
  --bg-elevated: #ffffff;
  --bg-surface: #f3f2ef;
  --text: #1c1c1a;
  --text-muted: #5c5a55;
  --border: #e5e3df;
  --accent: #1e3a5f;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--bg));
  --thesis-bg: color-mix(in srgb, var(--text) 3.5%, var(--bg));
  --rule-subtle: #e4e4e7;
  --section-kicker: #71717a;
  --meta-tone: #a1a1aa;
  --excerpt-tone: #52525b;
  --about-heading: #18181b;
  --principles-tone: #3f3f46;
  --link-manifesto: #1d4ed8;
  --hero-title: #18181b;
}

/* --------------------------------------------------------------------------
   2. Reset leve + base
   -------------------------------------------------------------------------- */

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

html {
  scroll-behavior: smooth;
  hanging-punctuation: first last;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  font-optical-sizing: auto;
  line-height: var(--lh-body);
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 160ms var(--ease), text-decoration-color 160ms var(--ease);
}

a:hover {
  color: color-mix(in srgb, var(--accent) 75%, var(--text));
}

a:focus-visible,
button:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

code,
kbd,
samp,
pre,
.term {
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-variant-ligatures: none;
}

/* --------------------------------------------------------------------------
   3. Acessibilidade / progresso de leitura
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--space-4);
  z-index: 1000;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.875rem;
}

.skip-link:focus {
  left: var(--gutter);
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 900;
  width: 100%;
  height: 2px;
  margin: 0;
  padding: 0;
  border: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
}

.reading-progress::-webkit-progress-bar {
  background: transparent;
}

.reading-progress::-webkit-progress-value {
  background: var(--accent);
  transition: width 80ms linear;
}

.reading-progress::-moz-progress-bar {
  background: var(--accent);
}

/* Fallback quando JS define --progress num elemento div */
.reading-progress[role="progressbar"],
div.reading-progress {
  display: block;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}

div.reading-progress::after,
.reading-progress[role="progressbar"]::after {
  content: "";
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  transition: width 80ms linear;
}

/* --------------------------------------------------------------------------
   4. Chrome do site (header / nav / footer)
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 800;
  width: 100%;
  box-sizing: border-box;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem 1.5rem;
  max-width: var(--measure);
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  box-sizing: border-box;
}

.site-brand {
  margin: 0;
  line-height: 1.2;
}

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

.site-brand a:hover {
  color: var(--text);
  opacity: 0.85;
}

.brand-domain {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.brand-domain .tld {
  color: var(--section-kicker, #71717a);
}

.site-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
}

.site-nav {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.site-nav-primary ul,
.site-nav-utils {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav-primary a {
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.72;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.site-nav-primary a:hover,
.site-nav-primary a[aria-current="page"] {
  color: var(--text);
  opacity: 1;
}

.nav-divider {
  display: inline-block;
  width: 1px;
  height: 0.9rem;
  background: var(--border);
  opacity: 0.9;
}

.site-nav-utils {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.site-footer {
  margin-top: var(--space-8);
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

.site-footer-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-6) 1.5rem var(--space-7);
  box-sizing: border-box;
}

.site-footer p {
  margin: 0;
}

/* --------------------------------------------------------------------------
   5. Layout de leitura
   -------------------------------------------------------------------------- */

main#conteudo,
.site-main {
  max-width: var(--measure);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1.5rem var(--space-8);
  box-sizing: border-box;
}

.essay-page main#conteudo,
main#conteudo:has(.essay) {
  max-width: var(--measure);
}

.essay {
  position: relative;
}

.essay > header {
  max-width: var(--measure);
  margin-bottom: var(--space-7);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.essay-meta,
.meta,
.post-meta {
  margin: 0 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  line-height: 1.5;
}

.essay-meta a,
.post-meta a {
  color: var(--accent);
  text-decoration: none;
}

.essay h1,
.essay > header h1 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--text);
}

.essay-author,
.essay > header > p:not(.essay-meta):not(.post-meta) {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.essay-tags,
.essay > header ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.essay-tags li,
.essay > header ul li {
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.essay-body,
.essay > div:not([class]) {
  position: relative;
  max-width: var(--measure);
}

/* Listagens (home / trilhas) */
.page-section + .page-section {
  margin-top: var(--space-7);
}

.hero-manifesto {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule-subtle, #27272a);
}

.hero-header {
  margin: 0 0 1.5rem;
}

.hero-kicker {
  display: block;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--meta-tone, #a1a1aa);
}

.hero-manifesto .hero-title,
.page-section .hero-title {
  margin: 0;
  max-width: 22ch;
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--hero-title, #f4f4f5);
}

.manifesto-lead {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.manifesto-lead p {
  margin: 0 0 1.25rem;
  line-height: 1.75;
  max-width: none;
}

.manifesto-lead > p:last-child {
  margin-bottom: 0;
}

/* Caixa de destaque editorial com sotaque de cor */
.manifesto-highlight {
  margin-top: 2rem;
  margin-bottom: 0;
  padding: 1.25rem 1.5rem;
  background: rgba(217, 119, 6, 0.05); /* Toque âmbar sutil */
  border-left: 3px solid #d97706; /* Linha de destaque em tom âmbar quente */
  border-radius: 0 6px 6px 0;
}

.manifesto-highlight .manifesto-note {
  margin: 0 0 0.75rem;
  padding-left: 0 !important;
  border-left: none !important;
  color: #e4d5b7 !important; /* Tom pergaminho/marfim legível e quente */
  font-size: 0.95rem;
  line-height: 1.6;
  font-family: inherit;
  max-width: none;
}

.manifesto-highlight .link-manifesto {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0;
  color: #fbbf24 !important; /* Âmbar brilhante para o link */
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

.manifesto-highlight .link-manifesto:hover {
  color: #fef08a !important;
  transform: translateX(3px);
  text-decoration: none;
}

/* Tema claro (padrão :root, .light-theme, ou SO claro) */
:root:not(.dark-theme) .manifesto-highlight,
html.light-theme .manifesto-highlight {
  background: #fbf6ee;
  border-left-color: #b45309;
}

:root:not(.dark-theme) .manifesto-highlight .manifesto-note,
html.light-theme .manifesto-highlight .manifesto-note {
  color: #451a03 !important;
}

:root:not(.dark-theme) .manifesto-highlight .link-manifesto,
html.light-theme .manifesto-highlight .link-manifesto {
  color: #b45309 !important;
}

:root:not(.dark-theme) .manifesto-highlight .link-manifesto:hover,
html.light-theme .manifesto-highlight .link-manifesto:hover {
  color: #78350f !important;
}

/* Tema escuro via preferência do SO (sem classe forçada) */
@media (prefers-color-scheme: dark) {
  :root:not(.light-theme) .manifesto-highlight {
    background: rgba(217, 119, 6, 0.05);
    border-left-color: #d97706;
  }

  :root:not(.light-theme) .manifesto-highlight .manifesto-note {
    color: #e4d5b7 !important;
  }

  :root:not(.light-theme) .manifesto-highlight .link-manifesto {
    color: #fbbf24 !important;
  }

  :root:not(.light-theme) .manifesto-highlight .link-manifesto:hover {
    color: #fef08a !important;
  }
}

html.dark-theme .manifesto-highlight {
  background: rgba(217, 119, 6, 0.05);
  border-left-color: #d97706;
}

html.dark-theme .manifesto-highlight .manifesto-note {
  color: #e4d5b7 !important;
}

html.dark-theme .manifesto-highlight .link-manifesto {
  color: #fbbf24 !important;
}

html.dark-theme .manifesto-highlight .link-manifesto:hover {
  color: #fef08a !important;
}

.home-feed {
  margin-top: 0;
}

.section-kicker,
.home-feed .section-kicker {
  margin: 0 0 1.75rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--section-kicker);
  line-height: 1.4;
}

.page-section h1,
.page-section h2:not(.section-kicker) {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
  line-height: 1.25;
}

.page-section h1 {
  margin: 0 0 var(--space-4);
  font-size: clamp(1.85rem, 3.5vw, 2.35rem);
}

.page-section h2:not(.section-kicker) {
  margin: 0 0 var(--space-4);
  font-size: 1.35rem;
}

.about-page .about-title {
  font-size: 2.2rem;
  margin: 0 0 1.75rem;
  letter-spacing: -0.02em;
}

.about-section {
  margin-bottom: 2.2rem;
}

.about-section:last-child {
  margin-bottom: 0;
}

.about-page .about-section h2,
.page-section .about-section h2 {
  margin-top: 1.8rem;
  margin-bottom: 0.6rem;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--about-heading, #f4f4f5);
}

.about-section:first-of-type h2 {
  margin-top: 0;
}

.editorial-principles {
  margin: 0 0 0 1.2rem;
  padding: 0;
  line-height: 1.7;
  color: var(--principles-tone, #d4d4d8);
}

.editorial-principles li {
  margin-bottom: 0.85rem;
}

.editorial-principles li:last-child {
  margin-bottom: 0;
}

.post-list,
.trilha-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Container do item de ensaio */
.essay-item,
.post-list-item,
.post-list > li {
  margin: 0 0 2.75rem;
  padding-top: 0;
  border-top: 0;
  transition: transform 0.2s ease;
}

.essay-item:last-child,
.post-list-item:last-child,
.post-list > li:last-child {
  margin-bottom: 0;
}

.post-list > li + li {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.trilha-list > li + li {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.trilha-list > .essay-item,
.trilha-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

/* Título com transição de cor fluida */
.essay-item-title {
  margin: 0 0 0.4rem;
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 500;
  line-height: 1.35;
}

.trilha-list .essay-item-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  flex: 1 1 auto;
  min-width: 0;
}

.essay-item-title a,
a.essay-item-title {
  display: inline-block;
  color: #f4f4f5;
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}

/* Hover no título: tom âmbar sofisticado alinhado com o destaque do manifesto */
.essay-item-title a:hover,
a.essay-item-title:hover {
  color: #fbbf24 !important;
  transform: translateX(3px);
}

:root:not(.dark-theme) .essay-item-title a,
:root:not(.dark-theme) a.essay-item-title,
html.light-theme .essay-item-title a,
html.light-theme a.essay-item-title {
  color: #1c1917;
}

:root:not(.dark-theme) .essay-item-title a:hover,
:root:not(.dark-theme) a.essay-item-title:hover,
html.light-theme .essay-item-title a:hover,
html.light-theme a.essay-item-title:hover {
  color: #b45309 !important;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-theme) .essay-item-title a,
  :root:not(.light-theme) a.essay-item-title {
    color: #f4f4f5;
  }

  :root:not(.light-theme) .essay-item-title a:hover,
  :root:not(.light-theme) a.essay-item-title:hover {
    color: #fbbf24 !important;
  }
}

html.dark-theme .essay-item-title a,
html.dark-theme a.essay-item-title {
  color: #f4f4f5;
}

html.dark-theme .essay-item-title a:hover,
html.dark-theme a.essay-item-title:hover {
  color: #fbbf24 !important;
}

/* Metadados refinados (Categoria · Data · Leitura) */
.essay-item .essay-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: #a1a1aa;
  line-height: 1.45;
}

.essay-item .essay-meta .meta-category {
  color: #93c5fd; /* Azul suave para categoria */
  font-weight: 500;
}

:root:not(.dark-theme) .essay-item .essay-meta .meta-category,
html.light-theme .essay-item .essay-meta .meta-category {
  color: #1d4ed8;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-theme) .essay-item .essay-meta .meta-category {
    color: #93c5fd;
  }
}

html.dark-theme .essay-item .essay-meta .meta-category {
  color: #93c5fd;
}

.essay-item .essay-meta .meta-separator {
  opacity: 0.4;
}

/* Resumo do ensaio */
.essay-summary {
  margin: 0;
  max-width: 68ch;
  color: #d4d4d8;
  font-size: 0.95rem;
  line-height: 1.6;
}

:root:not(.dark-theme) .essay-summary,
html.light-theme .essay-summary {
  color: #44403c;
}

@media (prefers-color-scheme: dark) {
  :root:not(.light-theme) .essay-summary {
    color: #d4d4d8;
  }
}

html.dark-theme .essay-summary {
  color: #d4d4d8;
}

.trilha-list time {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.6;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   6. Prosa do ensaio (ritmo vertical)
   -------------------------------------------------------------------------- */

.essay-body > :first-child,
.essay > div:not([class]) > :first-child {
  margin-top: 0;
}

.essay-body p,
.essay > div:not([class]) p,
.page-section p,
article p {
  margin: 0 0 1.35em;
  max-width: var(--measure);
}

.about-page p,
article.about-page p {
  margin: 0 0 1.5rem;
  line-height: 1.8;
  max-width: none;
}

.about-page p:last-child {
  margin-bottom: 0;
}

.essay-body p + p,
.essay > div:not([class]) p + p {
  margin-top: -0.15em;
}

.essay-body h2,
.essay > div:not([class]) h2,
article h2 {
  margin: 2.4em 0 0.75em;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.essay-body h3,
.essay > div:not([class]) h3,
article h3 {
  margin: 2em 0 0.65em;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
}

.essay-body h2 + p,
.essay-body h3 + p,
.essay > div:not([class]) h2 + p,
.essay > div:not([class]) h3 + p {
  margin-top: 0;
}

.essay-body ul,
.essay-body ol,
.essay > div:not([class]) ul,
.essay > div:not([class]) ol {
  margin: 0 0 1.35em;
  padding-left: 1.25em;
  max-width: var(--measure);
}

.essay-body li + li,
.essay > div:not([class]) li + li {
  margin-top: 0.4em;
}

.essay-body blockquote,
.essay > div:not([class]) blockquote {
  margin: 1.75em 0;
  padding: 0.15em 0 0.15em 1.15em;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  font-style: italic;
  max-width: var(--measure);
}

.essay-body blockquote p:last-child,
.essay > div:not([class]) blockquote p:last-child {
  margin-bottom: 0;
}

.essay-body hr,
.essay > div:not([class]) hr {
  width: 4rem;
  margin: 2.75em auto;
  border: 0;
  border-top: 1px solid var(--border);
}

.essay-body strong,
.essay > div:not([class]) strong {
  font-weight: 600;
}

.essay-body em,
.essay > div:not([class]) em {
  font-style: italic;
}

.essay-body code,
.essay > div:not([class]) code,
.term {
  padding: 0.1em 0.35em;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.84em;
}

.essay-body pre,
.essay > div:not([class]) pre {
  margin: 1.75em 0;
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.84rem;
  line-height: 1.55;
  max-width: 100%;
}

.essay-body pre code,
.essay > div:not([class]) pre code {
  padding: 0;
  background: none;
  border: 0;
  font-size: inherit;
}

.essay-body a,
.essay > div:not([class]) a {
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}

.essay-body a:hover,
.essay > div:not([class]) a:hover {
  text-decoration-color: var(--accent);
}

/* --------------------------------------------------------------------------
   7. Caixas editoriais
   -------------------------------------------------------------------------- */

.abstract-box,
.reflection-box,
.curation-box {
  max-width: var(--measure);
  margin: 2em 0;
  padding: var(--space-5) var(--space-5) var(--space-5) var(--space-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.abstract-box {
  border: 0;
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  background: var(--thesis-bg);
  padding: 1.25rem;
}

.abstract-box > :first-child,
.reflection-box > :first-child,
.curation-box > :first-child {
  margin-top: 0;
}

.abstract-box > :last-child,
.reflection-box > :last-child,
.curation-box > :last-child {
  margin-bottom: 0;
}

.abstract-box::before,
.reflection-box::before,
.curation-box::before {
  display: block;
  margin-bottom: var(--space-3);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.abstract-box::before {
  content: "Tese";
}

.reflection-box {
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, var(--border));
}

.reflection-box::before {
  content: "Para refletir";
}

.curation-box {
  font-size: 0.98rem;
}

.curation-box::before {
  content: "Referências";
}

.curation-box ol,
.curation-box ul {
  margin: 0;
  padding-left: 1.15em;
}

.curation-box li + li {
  margin-top: 0.65em;
}

.curation-box li {
  padding-left: 0.25em;
  color: var(--text-muted);
}

.curation-box cite,
.curation-box em {
  font-style: italic;
  color: var(--text);
}

/* --------------------------------------------------------------------------
   8. Sidenotes (Tufte) — desktop marginais / mobile details
   -------------------------------------------------------------------------- */

.sidenote-number,
.sidenote-ref {
  font-family: var(--font-sans);
  font-size: 0.7em;
  font-weight: 600;
  color: var(--accent);
  vertical-align: super;
  line-height: 0;
}

.sidenote {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-muted);
  hyphens: auto;
}

.sidenote details {
  margin: 1.25em 0;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
}

.sidenote summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}

.sidenote summary::-webkit-details-marker {
  display: none;
}

.sidenote summary::before {
  content: "Nota · ";
  font-weight: 500;
  color: var(--text-muted);
}

.sidenote details[open] summary {
  margin-bottom: var(--space-2);
}

.sidenote details > *:not(summary) {
  margin: 0;
}

/* Desktop: nota na margem direita; details aberto visualmente sem chrome */
@media (min-width: 1100px) {
  .essay-body,
  .essay > div:not([class]) {
    width: var(--measure);
  }

  .sidenote {
    float: right;
    clear: right;
    width: var(--sidenote-width);
    margin: 0.15em calc(-1 * (var(--sidenote-width) + var(--sidenote-gap))) 1em var(--sidenote-gap);
    position: relative;
  }

  .sidenote details {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
  }

  .sidenote summary {
    display: none;
  }

  .sidenote details > *:not(summary) {
    display: block !important;
  }

  /* Força conteúdo visível mesmo com details fechado no markup */
  .sidenote details:not([open]) > *:not(summary) {
    display: block !important;
  }
}

/* --------------------------------------------------------------------------
   9. Utilitários tipográficos
   -------------------------------------------------------------------------- */

.lede,
.deck {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.small-caps {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.04em;
}

.text-muted {
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   10. Impressão
   -------------------------------------------------------------------------- */

@media print {
  :root {
    --bg: #fff;
    --text: #000;
    --text-muted: #333;
    --border: #ccc;
    --accent: #000;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }

  .skip-link,
  .reading-progress,
  .site-header,
  .site-nav,
  .site-footer,
  nav,
  header.site-header {
    display: none !important;
  }

  main#conteudo,
  .site-main,
  .essay-page main#conteudo,
  main#conteudo:has(.essay) {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .essay > header {
    border-bottom-color: #000;
  }

  a {
    color: inherit;
    text-decoration: underline;
  }

  .essay-body a[href]::after,
  .essay > div:not([class]) a[href]::after {
    content: " (" attr(href) ")";
    font-family: var(--font-sans);
    font-size: 0.85em;
    color: #444;
    word-break: break-all;
  }

  .essay-body a[href^="#"]::after,
  .essay-body a[href^="/"]::after,
  .essay > div:not([class]) a[href^="#"]::after,
  .essay > div:not([class]) a[href^="/"]::after {
    content: none;
  }

  .sidenote {
    float: none;
    width: auto;
    margin: 1em 0;
    padding: 0.5em 0 0.5em 0.75em;
    border-left: 1px solid #999;
    page-break-inside: avoid;
  }

  .sidenote summary {
    display: none;
  }

  .sidenote details > *:not(summary) {
    display: block !important;
  }

  .abstract-box,
  .reflection-box,
  .curation-box,
  .essay-body pre,
  blockquote {
    break-inside: avoid;
  }

  h2,
  h3 {
    break-after: avoid;
  }
}

/* --------------------------------------------------------------------------
   11. Anatomia do ensaio (badges, curadoria, nav)
   -------------------------------------------------------------------------- */

.essay-header {
  max-width: var(--measure);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.essay-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  padding: 0;
  list-style: none;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  background: transparent;
}

a.badge:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

.badge-trilha {
  color: var(--text-muted);
  border-color: var(--border);
  background: transparent;
}

.essay-curation {
  margin: var(--space-3) 0 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.essay-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
}

.reflection-list {
  margin: 0;
  padding-left: 1.2em;
}

.reflection-list li + li {
  margin-top: 0.65em;
}

.curation-box.bibliography::before {
  content: none;
}

.bibliography-title {
  margin: 0 0 var(--space-4);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.bibliography-list {
  margin: 0;
  padding-left: 1.15em;
}

.bibliography-list li + li {
  margin-top: 0.85em;
}

.bib-author {
  font-weight: 600;
  color: var(--text);
}

.bibliography-list cite {
  font-style: italic;
  color: var(--text);
}

.bib-note {
  display: block;
  margin-top: 0.25em;
  font-size: 0.92em;
  color: var(--text-muted);
}

.essay-footer {
  max-width: var(--measure);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.essay-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .essay-nav {
    grid-template-columns: 1fr 1fr;
  }

  .essay-nav-next {
    text-align: right;
  }
}

.essay-nav a {
  display: inline-flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text);
  text-decoration: none;
  max-width: 100%;
}

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

.essay-nav-label {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.essay-nav-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}

@media print {
  .essay-nav,
  .essay-badges a {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   12. Theme toggle + heading anchors (JS-enhanced)
   -------------------------------------------------------------------------- */

.theme-toggle {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  opacity: 0.72;
  cursor: pointer;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  opacity: 1;
}

.theme-toggle[aria-pressed="true"] {
  color: var(--text);
  opacity: 1;
}

.essay-body h2,
.essay-body h3,
article.essay h2,
article.essay h3 {
  position: relative;
}

.heading-anchor {
  margin-left: 0.35em;
  padding: 0 0.25em;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1;
  color: var(--border);
  cursor: pointer;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 160ms var(--ease), color 160ms var(--ease);
}

.essay-body h2:hover .heading-anchor,
.essay-body h3:hover .heading-anchor,
.essay-body h2:focus-within .heading-anchor,
.essay-body h3:focus-within .heading-anchor,
.heading-anchor:focus-visible,
.heading-anchor.is-copied {
  opacity: 1;
  color: var(--accent);
}

.heading-anchor.is-copied {
  color: var(--accent);
}

@media (pointer: coarse) {
  .heading-anchor {
    opacity: 0.55;
  }
}

@media print {
  .theme-toggle,
  .heading-anchor {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   13. i18n UI
   -------------------------------------------------------------------------- */

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  opacity: 0.72;
}

.lang-switch a {
  color: inherit;
  text-decoration: none;
}

.lang-switch a:hover {
  color: var(--text);
  opacity: 1;
}

.lang-switch [aria-current="true"] {
  color: var(--text);
  opacity: 1;
}

.box-label {
  margin: 0 0 var(--space-3);
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.abstract-box::before,
.reflection-box::before {
  content: none;
}

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

/* --------------------------------------------------------------------------
   14. Engajamento — reações e comentários
   -------------------------------------------------------------------------- */

.engagement {
  max-width: var(--measure);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.engagement-title {
  margin: 0 0 var(--space-4);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: var(--space-7);
}

.reaction-btn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, opacity 0.2s ease, color 0.2s ease;
}

.reaction-btn:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  opacity: 0.92;
}

.reaction-btn.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--text);
}

.reaction-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
  font-size: 0.8em;
}

.comments {
  margin-top: var(--space-5);
}

.comments-empty {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.comment-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.comment-item:first-child {
  border-top: 1px solid var(--border);
}

.comment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.comment-author {
  color: var(--text);
  font-weight: 600;
}

.comment-body {
  font-size: 1.02rem;
  line-height: 1.7;
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: var(--space-5);
}

.comment-form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .comment-form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.comment-form label {
  display: grid;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-surface);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.5;
}

.comment-form textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.65;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
}

.field-hint {
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0;
}

.comment-form-actions {
  display: flex;
  justify-content: flex-start;
}

.comment-submit {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.comment-submit:hover {
  opacity: 0.88;
}

.comment-flash {
  margin: 0 0 var(--space-4);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.comment-flash-err {
  color: #8b2e2e;
}

.honeypot,
.hidden-field.honeypot {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  opacity: 0 !important;
  height: 0 !important;
  width: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

@media print {
  .engagement {
    display: none !important;
  }
}
