/* ============================================================
   Diálogos com a Literatura — folha de estilo
   Conceito: a biblioteca à noite. Fundo tinta-da-noite; o texto
   do ensaio abre como uma página de papel envelhecido sob uma
   luz de leitura; anotações à margem (marginália) reencenam o
   hábito de ler com lápis na mão — o diálogo que dá nome ao blog.
   ============================================================ */

:root {
  --ink:        #161C24;   /* fundo principal, tinta da noite */
  --ink-soft:   #1E2632;   /* painéis um tom mais claros sobre o fundo escuro */
  --ink-line:   #2C3646;   /* hairlines sobre fundo escuro */
  --paper:      #F1E8D6;   /* página aberta, papel envelhecido */
  --paper-line: #D8C9A3;   /* hairlines sobre o papel */
  --text-paper: #2A2015;   /* tinta sobre papel */
  --bone:       #EAE2D2;   /* texto claro sobre fundo escuro */
  --muted:      #8B93A3;   /* texto secundário sobre fundo escuro */
  --muted-paper:#7A6E56;   /* texto secundário sobre papel */
  --gold:       #B8935F;   /* folha de ouro — acento primário */
  --wine:       #7B3B3B;   /* vinho — acento da marginália */

  --serif-display: 'Fraunces', Georgia, serif;
  --serif-body:    'Source Serif 4', Georgia, serif;
  --sans:          'Inter', -apple-system, sans-serif;
  --hand:          'Caveat', cursive;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--serif-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Cabeçalho / navegação ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem clamp(1.25rem, 5vw, 4rem);
  border-bottom: 1px solid var(--ink-line);
}

.site-header a.brand {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--bone);
}

.site-header .brand em {
  font-style: italic;
  color: var(--gold);
}

.site-header nav a {
  font-family: var(--sans);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--muted);
  margin-left: 1.5rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

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

/* ---------- Hero (index) ---------- */

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(1.5rem, 4vw, 3rem);
  max-width: 1240px;
  padding: clamp(3rem, 8vw, 6rem) clamp(1.25rem, 5vw, 4rem) clamp(2.5rem, 6vw, 4rem);
}

.hero-text {
  flex: 1 1 440px;
  max-width: 580px;
}

.hero-art {
  flex: 0 1 170px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.65rem;
  padding-top: 0.5rem;
}

.hero-art svg {
  width: 68px;
  height: auto;
}

.hero-quote {
  font-family: var(--serif-body);
  font-style: italic;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--bone);
  max-width: 190px;
}

.hero-quote-attr {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

@media (max-width: 720px) {
  .hero-art { flex-basis: 100%; }
}

/* ---------- Próxima leitura (acervo disponível) ---------- */

.next-read {
  flex: 1 1 300px;
  max-width: 340px;
  background: var(--ink-soft);
  border: 1px solid var(--ink-line);
  border-radius: 4px;
  padding: 1.5rem 1.5rem 1.25rem;
}

.next-read h2 {
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin: 0 0 0.5rem;
}

.next-read .next-read-sub {
  font-family: var(--sans);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 1rem;
}

.next-read .next-read-sub em { color: var(--bone); font-style: italic; }

.next-read ul {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  border-top: 1px solid var(--ink-line);
}

.next-read li {
  padding: 0.6rem 0.1rem;
  border-bottom: 1px solid var(--ink-line);
  line-height: 1.4;
}

.next-read .book-title {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--bone);
}

.next-read .dash {
  color: var(--muted);
  margin: 0 0.35rem;
}

.next-read .book-meta {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.next-read ul::-webkit-scrollbar { width: 6px; }
.next-read ul::-webkit-scrollbar-track { background: transparent; }
.next-read ul::-webkit-scrollbar-thumb { background: var(--ink-line); border-radius: 3px; }

@media (max-width: 720px) {
  .next-read { flex-basis: 100%; max-width: 100%; }
}

.hero .eyebrow {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 1rem;
}

.hero h1 {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 1.08;
  margin: 0 0 1.25rem;
  color: var(--bone);
}

.hero h1 em { font-style: italic; color: var(--gold); font-weight: 500; }

.hero p.lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 1.75rem;
}

.hero .signature {
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--gold);
}

/* ---------- Palavras-tema (a assinatura do leitor) ---------- */

.theme-words {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0 clamp(1.25rem, 5vw, 4rem) 3rem;
  max-width: 780px;
}

.theme-words span {
  font-family: var(--sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
}

/* ---------- Estante de ensaios ---------- */

.shelf {
  padding: 0 clamp(1.25rem, 5vw, 4rem) 6rem;
  max-width: 860px;
}

.shelf h2.section-label {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  border-top: 1px solid var(--ink-line);
  padding-top: 1.5rem;
  margin: 0 0 1.5rem;
}

/* ---------- Filtro por tema ---------- */

.theme-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 2rem;
}

.theme-pill {
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.theme-pill:hover { color: var(--bone); border-color: var(--gold); }

.theme-pill.is-active {
  color: var(--ink);
  background: var(--gold);
  border-color: var(--gold);
}

.essay-card.is-hidden { display: none; }

.essay-card {
  display: block;
  text-decoration: none;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--ink-line);
  transition: padding-left 0.2s ease;
}

.essay-card:hover { padding-left: 0.5rem; }

.essay-card .date {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.essay-card h3 {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--bone);
  margin: 0.4rem 0 0.5rem;
  line-height: 1.25;
}

.essay-card p {
  color: var(--muted);
  font-size: 0.98rem;
  margin: 0;
  max-width: 68ch;
}

.essay-card.pending {
  opacity: 0.55;
  cursor: default;
}

.essay-card.pending:hover { padding-left: 0; }

.essay-card .status {
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border: 1px solid var(--ink-line);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  margin-left: 0.6rem;
}

/* ---------- Rodapé ---------- */

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 2.5rem clamp(1.25rem, 5vw, 4rem);
  border-top: 1px solid var(--ink-line);
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}

.footer-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-avatar {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink-soft);
  border: 1px solid var(--ink-line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: var(--serif-display);
  font-size: 0.65rem;
  letter-spacing: 0.02em;
  color: var(--gold);
}

.footer-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.footer-tagline { margin: 0; }

.footer-contact {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

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

.footer-contact a:hover { color: var(--gold); }

.footer-dot { color: var(--ink-line); }

/* ============================================================
   Página de ensaio — a página aberta
   ============================================================ */

.book-page-wrap {
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at center, rgba(0,0,0,0) 55%, rgba(74,56,32,0.09) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch' result='noise'/%3E%3CfeColorMatrix in='noise' type='matrix' values='0 0 0 0 0.42 0 0 0 0 0.32 0 0 0 0 0.18 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: no-repeat, repeat;
  background-size: 100% 100%, 220px 220px;
  color: var(--text-paper);
}

.essay-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5rem) clamp(1.25rem, 6vw, 3rem) 2rem;
}

.essay-header .tag {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--wine);
}

.essay-header h1 {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.15;
  margin: 0.6rem 0 0.75rem;
}

.essay-header .meta {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted-paper);
}

.essay-body-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 6vw, 3rem) 5rem;
}

/* Grid de duas colunas: texto corrido à esquerda, marginália à
   direita. Parágrafos e títulos ficam explicitamente na coluna 1;
   as notas de leitura, na coluna 2 — o auto-placement do grid as
   posiciona automaticamente próximas ao parágrafo em que aparecem
   no HTML, sem precisar calcular linhas manualmente. */

.essay-grid {
  display: grid;
  grid-template-columns: minmax(0, 700px) 300px;
  column-gap: 2.5rem;
}

.essay-body h2 {
  grid-column: 1;
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.4rem;
  margin: 2.5rem 0 1rem;
  color: var(--text-paper);
}

.essay-body p {
  grid-column: 1;
  font-size: 1.08rem;
  line-height: 1.75;
  margin: 0 0 1.2rem;
}

.essay-body p:first-of-type::first-letter {
  font-family: var(--serif-display);
  font-size: 3.6rem;
  font-weight: 600;
  float: left;
  line-height: 0.85;
  padding: 0.05em 0.08em 0 0;
  color: var(--wine);
}

/* Marginália: notas de leitura, no espírito de quem lê com um
   lápis na mão — a prática que dá nome ao blog. */

.marginnote {
  grid-column: 2;
  align-self: start;
  padding-left: 1rem;
  border-left: 2px solid var(--wine);
  font-family: var(--hand);
  font-size: 1.3rem;
  line-height: 1.35;
  color: var(--wine);
}

.marginnote .label {
  display: block;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-paper);
  margin-bottom: 0.3rem;
}

@media (max-width: 980px) {
  .essay-grid {
    grid-template-columns: 1fr;
  }
  .marginnote {
    grid-column: 1;
    margin: 0.5rem 0 1.5rem;
    padding: 0.9rem 1rem;
    background: rgba(123, 59, 59, 0.06);
    border-left: 3px solid var(--wine);
  }
}

.essay-nav {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 6vw, 3rem) 4rem;
  border-top: 1px solid var(--paper-line);
  font-family: var(--sans);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.essay-nav a {
  text-decoration: none;
  color: var(--wine);
}

.share-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.share-links a:hover { text-decoration: underline; }

/* ---------- Leia também (ensaios relacionados) ---------- */

.related-essays {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 6vw, 3rem);
}

.related-essays h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--wine);
  border-top: 1px solid var(--paper-line);
  padding-top: 2.5rem;
  margin: 0 0 1.5rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.75rem;
}

.related-card {
  display: block;
  text-decoration: none;
}

.related-card .related-title {
  display: block;
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--text-paper);
  margin-bottom: 0.4rem;
}

.related-card:hover .related-title { color: var(--wine); }

.related-card .related-desc {
  display: block;
  font-family: var(--sans);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted-paper);
}

.author-note {
  max-width: 68ch;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-style: italic;
  color: var(--muted-paper);
  border-top: 1px solid var(--paper-line);
  padding-top: 1.5rem;
  margin-top: 2.5rem;
}

/* ---------- Comentários e sugestões (envio por e-mail, moderado) ----------
   Cada leitura recebe um convite discreto — no espírito de quem escreve
   à margem — para que o leitor deixe um comentário. A mensagem é
   enviada por e-mail e revisada antes de qualquer publicação; nada
   aparece automaticamente no site. */

.comment-toggle {
  margin-top: 1.25rem;
}

.comment-toggle summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  color: var(--wine);
  padding: 0.35rem 0;
}

.comment-toggle summary::-webkit-details-marker { display: none; }
.comment-toggle summary::marker { content: ""; }

.comment-toggle summary .pen {
  font-family: var(--hand);
  font-size: 1.15rem;
}

.comment-toggle summary:hover { text-decoration: underline; }

.comment-form {
  margin-top: 0.9rem;
  padding: 1.4rem 1.5rem;
  max-width: 480px;
  background: rgba(123, 59, 59, 0.05);
  border-left: 3px solid var(--wine);
}

.comment-form p.note {
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted-paper);
  margin: 0 0 1rem;
}

.comment-form label {
  display: block;
  font-family: var(--sans);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-paper);
  margin-bottom: 0.3rem;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  font-family: var(--serif-body);
  font-size: 0.95rem;
  color: var(--text-paper);
  background: var(--paper);
  border: 1px solid var(--paper-line);
  border-radius: 2px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 1rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--wine);
}

.comment-form textarea {
  min-height: 110px;
  resize: vertical;
}

.comment-form button {
  font-family: var(--sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--paper);
  background: var(--wine);
  border: none;
  border-radius: 2px;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
}

.comment-form button:hover { opacity: 0.9; }
