/* reading.css - Leitura confortável ABM Estudos */

:root {
  --bg: #fdfdfd;
  --text: #2c3e50;
  --link: #4f46e5;
  --code-bg: #f4f4f4;
  --border: #e2e8f0;
  --muted: #64748b;
  --accent: #6366f1;
  --max-width: 820px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1d23;
    --text: #d1d5db;
    --link: #818cf8;
    --code-bg: #252830;
    --border: #2d3148;
    --muted: #6b7280;
    --accent: #818cf8;
  }
}

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

body {
  font-family: "Verdana", "Cambria", "Times New Roman", serif;
  line-height: 1.85;
  color: var(--text);
  background: var(--bg);
  margin: 0;
  padding: 2.5rem 1.5rem;
  display: flex;
  justify-content: center;
}

.container {
  max-width: var(--max-width);
  width: 100%;
}

/* ── Navigation bar ─────────────────────────────────────── */
.reading-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
}

.reading-nav a {
  color: var(--link);
  text-decoration: none;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition:
    background 0.15s,
    color 0.15s;
}

.reading-nav a:hover {
  background: var(--link);
  color: #fff;
  border-color: var(--link);
}

.reading-nav .print-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  transition:
    background 0.15s,
    color 0.15s;
}

.reading-nav .print-btn:hover {
  background: var(--muted);
  color: #fff;
}

/* ── Article typography ─────────────────────────────────── */
article h1 {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 1.5rem;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
  color: var(--text);
  text-align: justify;
}

article h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2.5rem 0 0.9rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  text-align: justify;
}

article h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 2rem 0 0.75rem;
  text-align: justify;
}

article p {
  margin-bottom: 1.4rem;
  text-align: justify;
  hyphens: auto;
  font-size: 1.05rem;
}

article a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}

article a:hover {
  text-decoration: none;
}

article em {
  color: var(--accent);
  font-style: italic;
}
article strong {
  color: var(--text);
  font-weight: 700;
}

article ul,
article ol {
  margin: 0.75rem 0 1.4rem 1.75rem;
}

article li {
  margin-bottom: 0.45rem;
  font-size: 1.02rem;
  text-align: justify;
}

article blockquote {
  margin: 1.5rem 0;
  padding: 0.75rem 1.5rem;
  border-left: 4px solid var(--accent);
  background: var(--code-bg);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--muted);
}

article pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 1.5rem 0;
}

article code {
  font-family: "Consolas", "Monaco", "Courier New", monospace;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.88em;
}

article pre code {
  border: none;
  background: transparent;
  padding: 0;
  font-size: inherit;
}

article hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

article table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}

article th,
article td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.9rem;
  text-align: left;
}

article th {
  background: var(--code-bg);
  font-weight: 600;
}

/* ── Footer ─────────────────────────────────────────────── */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  :root {
    --bg: #fff;
    --text: #000;
    --link: #000;
    --code-bg: #f8f8f8;
    --border: #ccc;
  }

  /* body {
    padding: 0.3in;
    font-size: 12pt;
  } */

  body {
    padding: 0.3in;
    font-size: 12pt;
    /* Adicionando a Garamond e substitutas clássicas */
    font-family: "EB Garamond", "Garamond", "Georgia", "Times New Roman", serif;
    line-height: 1.4; /* Melhora a legibilidade no papel */
    color: var(--text);
    background: var(--bg);
  }

  .reading-nav,
  .no-print {
    display: none;
  }
  article h1 {
    font-size: 1.2rem;
  }
  article h2 {
    font-size: 1.1rem;
  }
  article h3 {
    font-size: 1.1rem;
  }

  article h1,
  article h2,
  article h3 {
    page-break-after: avoid;
  }
  article p,
  article li {
    page-break-inside: avoid;
  }
  article a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  body {
    padding: 1.5rem 1rem;
  }
  article p,
  article li {
    font-size: 1rem;
  }
  article h1 {
    font-size: 1.4rem;
  }
}
