:root {
  --ink: #1d1d1f;
  --muted: #6b6b70;
  --accent: #7c1f1f;      /* deep red, echoing the old site's #800000 */
  --accent-soft: #f7efef;
  --rule: #e4e2df;
  --bg: #fcfbfa;
  --card: #ffffff;
  --serif: "Charter", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1.25rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; }
h1 { font-size: 1.9rem; margin: 1.2rem 0 0.6rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); background: var(--card); }
.site-header .wrap { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; padding-top: 0.9rem; padding-bottom: 0.9rem; gap: 0.5rem; }
.site-name { font-family: var(--serif); font-size: 1.25rem; color: var(--ink); }
.site-header nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
.site-header nav a { color: var(--ink); font-size: 0.95rem; padding-bottom: 2px; border-bottom: 2px solid transparent; }
.site-header nav a:hover { text-decoration: none; border-bottom-color: var(--rule); }
.site-header nav a.active { border-bottom-color: var(--accent); }

/* Home */
.hero { padding: 2.5rem 0 1rem; }
.hero h1 { font-size: 2.4rem; margin: 0 0 0.5rem; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 44rem; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 2rem 0 3rem; }
.card { display: block; background: var(--card); border: 1px solid var(--rule); border-radius: 8px; padding: 1.1rem 1.2rem; color: var(--ink); }
.card:hover { text-decoration: none; border-color: var(--accent); }
.card h2 { margin: 0 0 0.4rem; font-size: 1.15rem; color: var(--accent); }
.card p { margin: 0; font-size: 0.92rem; color: var(--muted); }

/* Home: featured publications + secondary links */
.feature-pub { background: var(--card); border: 1px solid var(--rule); border-radius: 10px; padding: 1.4rem 1.6rem; margin: 1.5rem 0; }
.feature-pub h2 { margin: 0 0 0.5rem; font-size: 1.35rem; }
.feature-pub h2 a { color: var(--accent); }
.feature-pub > p { color: var(--muted); max-width: 46rem; margin: 0 0 1rem; }
.cover-strip { display: flex; gap: 0.7rem; overflow-x: auto; padding-bottom: 0.4rem; }
.cover-strip img { height: 10rem; width: auto; border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.cover-strip a:hover img { border-color: var(--accent); }
.strip-more { margin: 0.6rem 0 0; font-size: 0.92rem; }
.home-secondary { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 0 0 3rem; }
.home-secondary .minor { flex: 1 1 18rem; border: 1px solid var(--rule); border-radius: 8px; padding: 0.7rem 1rem; font-size: 0.92rem; color: var(--muted); background: var(--card); }
.home-secondary .minor strong { color: var(--ink); }
.home-secondary .minor:hover { text-decoration: none; border-color: var(--accent); }

/* Book cover grid (/livros/) */
.cover-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1.4rem 1.2rem; margin: 1.5rem 0 3rem; }
.cover-item { display: block; text-align: center; color: var(--ink); }
.cover-item img { width: 100%; height: 13rem; object-fit: contain; border-radius: 4px; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.12)); }
.cover-item:hover { text-decoration: none; }
a.cover-item:hover .cover-caption { color: var(--accent); }
.cover-caption { display: block; margin-top: 0.5rem; font-size: 0.82rem; line-height: 1.35; }
.cover-caption em { color: var(--muted); font-style: normal; }
.cover-unlinked { opacity: 0.85; }

/* Publication detail: cover beside reference */
.pub-detail { display: flex; gap: 1.2rem; align-items: flex-start; max-width: 52rem; }
.pub-cover { width: 9rem; flex: 0 0 auto; border-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
@media (max-width: 40rem) { .pub-detail { flex-direction: column; } .pub-cover { width: 8rem; } }

/* Publications list */
.pub-filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; margin: 1.2rem 0; }
.pub-filters input[type="search"] { flex: 1 1 14rem; }
.pub-filters input, .pub-filters select {
  font: inherit; font-size: 0.92rem; padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--card); color: var(--ink);
}
.pub-count { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.pub-list { list-style: none; margin: 0 0 3rem; padding: 0; }
.pub-item { display: flex; gap: 1rem; padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--rule); }
.pub-year { flex: 0 0 4.6rem; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.92rem; padding-top: 0.1rem; }
.pub-body a { font-family: var(--serif); font-size: 1.02rem; color: var(--ink); }
.pub-body a:hover { color: var(--accent); }
.pub-type { display: inline-block; margin-left: 0.5rem; font-size: 0.78rem; color: var(--muted); }
.pub-doc { display: inline-block; margin-left: 0.5rem; font-size: 0.7rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0.05rem 0.35rem; vertical-align: 1px; }

/* Publication page */
.breadcrumb { font-size: 0.9rem; margin: 1.2rem 0 0; }
.pub-single h1 { max-width: 46rem; }
.pub-meta { color: var(--muted); font-size: 0.95rem; }
.pub-meta .pub-type { margin-left: 0; margin-right: 0.8rem; }
.pub-ref { background: var(--card); border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 6px; padding: 0.9rem 1.1rem; max-width: 46rem; font-size: 0.97rem; }
.pub-downloads { margin: 1.4rem 0 3rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.btn { display: inline-block; background: var(--accent); color: #fff; border-radius: 6px; padding: 0.5rem 1rem; font-size: 0.95rem; }
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn .size { opacity: 0.75; font-size: 0.85em; }
.btn-ext { background: var(--card); color: var(--accent); border: 1px solid var(--accent); }
.pub-nodoc { color: var(--muted); font-style: italic; }

/* Prose pages */
.prose { max-width: 46rem; margin-bottom: 3rem; }
.prose img { max-width: 100%; height: auto; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
.prose th, .prose td { border: 1px solid var(--rule); padding: 0.4rem 0.6rem; text-align: left; }
.page-list { padding-left: 1.2rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); margin-top: 2rem; background: var(--card); }
.site-footer .wrap { padding-top: 1rem; padding-bottom: 1.2rem; }
.site-footer p { margin: 0.2rem 0; font-size: 0.85rem; color: var(--muted); }

@media (max-width: 40rem) {
  .pub-item { flex-direction: column; gap: 0.1rem; }
  .hero h1 { font-size: 1.9rem; }
}
