/* Base de todas as páginas: cores, tipografia, botões, topo, rodapé e cabeçalho de página.
   Conceito "estante": papel quente e tinta escura, e cada livro com as cores da sua capa. */

/* ---------- Cores e fontes ---------- */
:root {
  --paper: #f6f2ea;
  --paper-2: #efe9dd;
  --card: #fffdf8;
  --ink: #1a1712;
  --ink-2: #3b362d;
  --muted: #6f6758;
  --line: #e2dacb;
  --dark: #1a1712;
  --dark-2: #25211a;
  --line-dark: #3a342a;
  --muted-dark: #b9b0a0;
  --accent: #b5551f;
  --radius: 18px;
  --shadow: 0 30px 60px -30px rgba(26, 23, 18, .45);
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --gutter: max(16px, (100% - 1160px) / 2);
}

/* Cores de cada livro: b1 azul da UFPE, b2 preto e ouro, b3 creme e laranja, b4 azul-noite. */
.b1 { --c: #0b8fd6; --c-deep: #0a6fa6; --c-bg: #e3f1fa; }
.b2 { --c: #f2b705; --c-deep: #8a6700; --c-bg: #f7efd2; }
.b3 { --c: #e8935a; --c-deep: #2a6f8f; --c-bg: #f3efe0; }
.b4 { --c: #f7941d; --c-deep: #0d1526; --c-bg: #e6e9f0; }

/* ---------- Elementos ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.12; letter-spacing: -.015em; margin: 0 0 .5em; color: var(--ink); }
p { margin: 0 0 1em; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* ---------- Utilitários ---------- */
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.eyebrow { font: 700 .76rem/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: 1rem; }
.h2 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.section { padding: clamp(64px, 9vw, 112px) 0; }
.section-head { max-width: 720px; margin-bottom: 48px; }
.section-head .muted { font-size: 1.08rem; }

/* ---------- Botões ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; padding: .85em 1.5em; border-radius: 999px; font: 600 .98rem/1.2 var(--sans); text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #000; }
.btn-ghost { border-color: var(--ink); color: var(--ink); background: none; }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-small { padding: .5em 1em; font-size: .85rem; background: var(--paper-2); color: var(--ink); }
.btn-small:hover { background: var(--ink); color: var(--paper); }

/* ---------- Topo ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(246, 242, 234, .88); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 600 1.15rem/1 var(--display); color: var(--ink); text-decoration: none; }
.brand-spines { display: inline-flex; align-items: flex-end; gap: 2px; height: 20px; }
.brand-spines i { display: block; width: 5px; border-radius: 1.5px; }
.brand-spines i:nth-child(1) { height: 18px; background: #0b8fd6; }
.brand-spines i:nth-child(2) { height: 20px; background: #f2b705; }
.brand-spines i:nth-child(3) { height: 17px; background: #e8935a; }
.brand-spines i:nth-child(4) { height: 19px; background: #3fb36b; transform: rotate(10deg); transform-origin: bottom left; }
.menu { display: flex; gap: 22px; margin-left: auto; }
.menu a { color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; }
.menu a:hover { color: var(--accent); }
.menu a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.lang { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.lang button { font: 600 .78rem/1 var(--sans); letter-spacing: .05em; color: var(--muted); background: none; border: 0; padding: 7px 10px; border-radius: 999px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- Cabeçalho das páginas internas ---------- */
.page-head { padding: clamp(48px, 7vw, 88px) 0 8px; }
.page-head h1 { font-size: clamp(2.4rem, 5.6vw, 4rem); }
.page-head .lead { font-size: 1.12rem; color: var(--ink-2); max-width: 44em; }
.page-stats { list-style: none; margin: 36px 0 0; padding: 22px 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 20px 56px; }
.page-stats li { display: flex; flex-direction: column; gap: 2px; }
.page-stats b { font: 600 clamp(1.7rem, 3vw, 2.2rem)/1 var(--display); }
.page-stats span { color: var(--muted); font-size: .9rem; }

/* ---------- Seções escuras ---------- */
.dark { background: var(--dark); color: #e9e3d6; }
.dark h2, .dark h3 { color: #fff; }
.dark .eyebrow { color: #e9a36d; }

/* ---------- Rodapé ---------- */
.footer { border-top: 1px solid var(--line); padding: 32px 0 40px; font-size: .9rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; }
.footer-books { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer p { margin: 0; }

/* ---------- Entrada suave ao rolar ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn { transition: none; }
}

@media (max-width: 760px) {
  /* O menu desce para uma segunda linha, rolável na horizontal se faltar espaço. */
  .topbar-inner { flex-wrap: wrap; height: auto; padding: 12px 0 0; row-gap: 4px; }
  .menu { order: 3; width: 100%; margin: 0; gap: 20px; overflow-x: auto; padding: 8px 0 12px; scrollbar-width: none; }
  .menu::-webkit-scrollbar { display: none; }
  .menu a { white-space: nowrap; }
  .lang { margin-left: auto; }
  html { scroll-padding-top: 110px; }
}

/* ---------- Janelas (contato e "como citar") ---------- */
.modal { width: min(560px, 100vw - 32px); max-height: calc(100vh - 32px); padding: 32px; border: 0; border-radius: var(--radius); background: var(--card); color: var(--ink); box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .45); }
.modal::backdrop { background: rgba(26, 23, 18, .6); }
.modal h2 { font-size: 1.6rem; padding-right: 32px; }
.modal-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--paper-2); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--line); }
.modal form { display: grid; gap: 14px; margin-top: 18px; }
.modal label { display: grid; gap: 6px; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.modal label small { font-weight: 400; color: var(--muted); }
.modal input, .modal select, .modal textarea { width: 100%; font: 400 1rem/1.4 var(--sans); color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.modal input:focus, .modal select:focus, .modal textarea:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .hp { position: absolute; left: -9999px; }
.modal .btn { justify-self: start; }
.form-error { margin: 0; padding: 10px 12px; border-radius: 10px; background: #fbe9e4; color: #8f2f13; font-size: .9rem; }
.fine { margin: 0; font-size: .8rem; color: var(--muted); }
.fine a { color: inherit; }
.done-icon { width: 52px; height: 52px; margin-bottom: 14px; border-radius: 50%; display: grid; place-items: center; background: #e6efe4; color: #2f6430; font-size: 1.5rem; font-weight: 700; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.cite-what { color: var(--muted); font-size: .95rem; }
.cite-tabs { display: flex; gap: 6px; margin: 18px 0 10px; }
.cite-tabs button { font: 600 .85rem/1 var(--sans); padding: 9px 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; }
.cite-tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.cite-box { padding: 16px; border-radius: 12px; background: var(--paper); border: 1px solid var(--line); font-size: .95rem; line-height: 1.6; overflow-wrap: anywhere; }
.cite-box.is-code { font: .82rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; }
.cite-actions { display: flex; align-items: center; gap: 14px; margin: 16px 0 10px; }
.cite-ok { color: #2f6430; font-weight: 600; font-size: .9rem; }
@media (max-width: 560px) { .modal { padding: 24px 20px; } .modal .row2 { grid-template-columns: 1fr; } }

/* ---------- Texto corrido (política de privacidade) ---------- */
.prose-section { padding-top: 32px; }
.prose { max-width: 760px; }
.prose h2 { font-size: 1.45rem; margin-top: 1.8em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .7em; }
.prose-cta { margin-top: 2.4em; }

/* ---------- Rodapé: perfis e links legais ---------- */
.footer-profiles { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer-legal { width: 100%; }
.profiles { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 4px 0 18px; font-size: .92rem; font-weight: 600; }
.profiles a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 4px; }
.profiles a:hover { color: var(--accent); text-decoration-color: currentColor; }
