/* =====================================================================
   Manual para Estudantes — PPGE-USP
   Estilo da versão HTML (gerada a partir de conteudo.md pelo pandoc)
   ===================================================================== */

:root {
  --fundo: #fbfaf6;
  --fundo-alt: #f2f0e8;
  --superficie: #ffffff;
  --texto: #1d2420;
  --texto-suave: #55605a;
  --linha: #e2ded2;
  --verde: #1f4d3a;
  --verde-claro: #2f6f52;
  --musgo: #8aa96b;
  --destaque: #f2b134;
  --link: #1f6e4c;
  --sombra: 0 1px 2px rgba(20, 40, 30, .06), 0 8px 24px rgba(20, 40, 30, .06);

  --fonte-texto: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fonte-titulo: "Fraunces", Georgia, "Times New Roman", serif;
  --largura-texto: 42rem;
  --largura-sumario: 17rem;
  --raio: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    --fundo: #111613; --fundo-alt: #171e1a; --superficie: #1a221e;
    --texto: #e3e8e4; --texto-suave: #9aa8a0; --linha: #2a352f;
    --verde: #8fd1ae; --verde-claro: #a9dcc0; --musgo: #6f8f55;
    --link: #8fd1ae; --sombra: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-tema="escuro"] {
  --fundo: #111613; --fundo-alt: #171e1a; --superficie: #1a221e;
  --texto: #e3e8e4; --texto-suave: #9aa8a0; --linha: #2a352f;
  --verde: #8fd1ae; --verde-claro: #a9dcc0; --musgo: #6f8f55;
  --link: #8fd1ae; --sombra: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--fonte-texto);
  font-size: 1.125rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
strong { font-weight: 700; }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- barra de progresso ---------- */
#progresso {
  position: fixed; inset: 0 auto auto 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--musgo), var(--destaque));
  z-index: 50; transition: width .1s linear;
}

/* ---------- topo e capa ---------- */
.topo { background: var(--verde); color: #f4f1e8; position: relative; overflow: hidden; }
:root[data-tema="escuro"] :is(.topo, .topo-barra) { background: #14271e; }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) :is(.topo, .topo-barra) { background: #14271e; } }

.topo::after { /* folhas/contornos decorativos */
  content: ""; position: absolute; right: -8rem; top: -6rem; width: 34rem; height: 34rem;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0 22px, rgba(255,255,255,.06) 23px 24px);
  pointer-events: none;
}

.topo-barra {
  position: sticky; top: 0; z-index: 45;
  background: var(--verde); color: #f4f1e8;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem clamp(1rem, 4vw, 2.5rem);
}
.topo-marca { font-weight: 700; letter-spacing: .14em; font-size: .8rem; opacity: .85; }

.botao-sumario, .botao-tema {
  display: inline-flex; align-items: center; gap: .45rem;
  background: rgba(255,255,255,.1); color: inherit; border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px; padding: .4rem .85rem; font: inherit; font-size: .9rem; cursor: pointer;
}
.botao-sumario:hover, .botao-tema:hover { background: rgba(255,255,255,.18); }
.botao-tema { padding: .45rem; }
.icone-lua { display: none; }
:root[data-tema="escuro"] .icone-sol { display: none; }
:root[data-tema="escuro"] .icone-lua { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) .icone-sol { display: none; }
  :root:not([data-tema="claro"]) .icone-lua { display: inline; }
}

.capa {
  position: relative; z-index: 1;
  max-width: calc(var(--largura-texto) + var(--largura-sumario) + 4rem);
  margin: 0 auto; padding: clamp(2rem, 6vw, 4.5rem) clamp(1rem, 4vw, 2.5rem) clamp(2.5rem, 6vw, 4rem);
}
.capa-instituicao {
  margin: 0 0 1rem; text-transform: uppercase; letter-spacing: .12em; font-size: .82rem; opacity: .85;
}
.capa-titulo {
  color: inherit;
  font-family: var(--fonte-titulo); font-weight: 600; font-variation-settings: "opsz" 144;
  font-size: clamp(2.4rem, 7vw, 4.4rem); line-height: 1.02; margin: 0; letter-spacing: -.02em;
}
.capa-ano { color: var(--destaque); font-weight: 400; }
.capa-resumo { max-width: 36rem; font-size: 1.2rem; opacity: .9; margin: 1.25rem 0 1.75rem; }
.capa-acoes { display: flex; flex-wrap: wrap; gap: .75rem; }
.capa-data { font-size: .85rem; opacity: .7; margin: 1.25rem 0 0; }

.botao {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.15rem; border-radius: var(--raio);
  border: 1px solid rgba(255,255,255,.35); color: #f4f1e8; text-decoration: none; font-weight: 600;
  transition: transform .15s ease, background .15s ease;
}
.botao:hover { background: rgba(255,255,255,.1); transform: translateY(-1px); text-decoration: none; }
.botao-principal { background: var(--destaque); border-color: var(--destaque); color: #1d2420; }
.botao-principal:hover { background: #f6c15a; }

/* ---------- grade principal ---------- */
.pagina {
  display: grid;
  grid-template-columns: var(--largura-sumario) minmax(0, var(--largura-texto));
  gap: clamp(2rem, 5vw, 4rem);
  justify-content: center;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
}

/* ---------- sumário ---------- */
.sumario {
  position: sticky; top: 3.2rem; align-self: start;
  max-height: calc(100vh - 3.2rem); overflow-y: auto; padding: 2.5rem 0 2rem;
  font-size: .95rem; line-height: 1.4;
  scrollbar-width: thin;
}
.sumario-cabecalho {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700;
  color: var(--texto-suave); margin-bottom: .75rem;
}
.fechar-sumario { display: none; }
.sumario ul { list-style: none; margin: 0; padding: 0; }
.sumario a {
  display: block; padding: .3rem .75rem; color: var(--texto-suave); text-decoration: none;
  border-left: 2px solid var(--linha);
}
.sumario a:hover { color: var(--texto); }
.sumario a.ativo { color: var(--verde); border-left-color: var(--verde); font-weight: 600; }

.sumario #TOC > ul { counter-reset: cap; }
.sumario #TOC > ul > li { counter-increment: cap; margin-top: .55rem; }
.sumario #TOC > ul > li > a { color: var(--texto); font-weight: 600; }
.sumario #TOC > ul > li > a::before {
  content: counter(cap) ". "; color: var(--musgo); font-variant-numeric: tabular-nums;
}
.sumario #TOC > ul > li > a.ativo { color: var(--verde); }
.sumario ul ul a { padding-left: 1.4rem; font-size: .9rem; }
.sumario ul ul { display: none; }
.sumario li.aberto > ul { display: block; }
.sumario-extra { margin-top: .55rem !important; }
.sumario-extra a { color: var(--texto) !important; font-weight: 600; }

/* ---------- conteúdo ---------- */
.conteudo { padding: 2.5rem 0 4rem; min-width: 0; }
.conteudo p { margin: 0 0 1.1em; hyphens: auto; }

.conteudo { counter-reset: capitulo; }
section.level1 { counter-increment: capitulo; padding-top: 1.5rem; }
section.level1 + section.level1 { border-top: 1px solid var(--linha); margin-top: 3rem; padding-top: 3.5rem; }

h1, h2, h3, h4, h5 { font-family: var(--fonte-titulo); color: var(--verde); line-height: 1.2; font-weight: 600; }
section.level1 > h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem); margin: 0 0 1.5rem; letter-spacing: -.015em;
  font-variation-settings: "opsz" 144;
}
section.level1 > h1::before {
  content: counter(capitulo, decimal-leading-zero);
  display: block; font-family: var(--fonte-texto); font-size: .9rem; font-weight: 700;
  letter-spacing: .2em; color: var(--musgo); margin-bottom: .4rem;
}
section.expediente > h1::before { content: "—"; }
h2 { font-size: 1.6rem; margin: 2.6rem 0 .9rem; }
h3 { font-size: 1.3rem; margin: 2rem 0 .7rem; }
h4 { font-size: 1.1rem; margin: 1.6rem 0 .6rem; font-family: var(--fonte-texto); font-weight: 700;
     letter-spacing: .02em; color: var(--texto); }

h1 a.ancora, h2 a.ancora, h3 a.ancora, h4 a.ancora {
  opacity: 0; margin-left: .4rem; font-size: .7em; text-decoration: none; color: var(--musgo);
  transition: opacity .15s;
}
:is(h1, h2, h3, h4):hover a.ancora, a.ancora:focus { opacity: 1; }

/* destaque das frases em negrito, como "marca-texto" discreto */
.conteudo p strong {
  background: linear-gradient(transparent 72%, color-mix(in srgb, var(--destaque) 22%, transparent) 72%);
  padding: 0 .1em;
}

/* listas */
.conteudo ul, .conteudo ol { padding-left: 1.4rem; margin: 0 0 1.2em; }
.conteudo li { margin: .3em 0; padding-left: .25rem; }
.conteudo ul li::marker { color: var(--musgo); }
.conteudo ol li::marker { color: var(--verde-claro); font-weight: 700; font-variant-numeric: tabular-nums; }

/* listas de definição: viram "fichas" */
.conteudo dl {
  display: grid; grid-template-columns: minmax(8rem, max-content) 1fr;
  margin: 0 0 1.5em; background: var(--superficie); border: 1px solid var(--linha);
  border-radius: var(--raio); box-shadow: var(--sombra); overflow: hidden;
}
.conteudo dt, .conteudo dd { padding: .75rem 1rem; margin: 0; border-top: 1px solid var(--linha); }
.conteudo dt:first-of-type, .conteudo dt:first-of-type + dd { border-top: 0; }
.conteudo dt { font-weight: 700; color: var(--verde); background: var(--fundo-alt); }
.conteudo dd p { margin: 0; }
@media (max-width: 40rem) {
  .conteudo dl { grid-template-columns: 1fr; }
  .conteudo dd { border-top: 0; padding-top: 0; }
  .conteudo dt { background: transparent; }
}

/* tabelas */
.conteudo table {
  width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 0 1.75em;
  background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio);
  box-shadow: var(--sombra); overflow: hidden; font-variant-numeric: tabular-nums;
}
.conteudo caption {
  caption-side: bottom; text-align: left; font-size: .92rem; color: var(--texto-suave);
  padding: .6rem .25rem 0;
}
.conteudo th, .conteudo td { padding: .65rem 1rem; border-top: 1px solid var(--linha); }
.conteudo thead th {
  border-top: 0; background: var(--fundo-alt); color: var(--verde); font-weight: 700;
  font-size: .95rem; line-height: 1.3; vertical-align: bottom;
}
.conteudo tbody td:first-child { font-weight: 600; }
.conteudo tbody td:not(:first-child) { font-size: 1.15rem; font-weight: 600; color: var(--verde-claro); }
.conteudo tbody tr:hover td { background: color-mix(in srgb, var(--musgo) 8%, transparent); }
@media (max-width: 40rem) {
  .conteudo th, .conteudo td { padding: .55rem .5rem; }
  .conteudo thead th { font-size: .85rem; }
}

/* links longos não estouram a coluna */
.conteudo a { overflow-wrap: anywhere; }

/* notas de rodapé */
a.footnote-ref { text-decoration: none; }
a.footnote-ref sup {
  font-size: .7em; font-weight: 700; color: var(--verde-claro);
  background: color-mix(in srgb, var(--musgo) 18%, transparent); border-radius: 4px; padding: 0 .3em; margin-left: .1em;
}
section.footnotes { font-size: .95rem; color: var(--texto-suave); margin-top: 3rem; }
section.footnotes hr { border: 0; border-top: 1px solid var(--linha); }
section.footnotes::before {
  content: "Notas"; display: block; font-family: var(--fonte-titulo); color: var(--verde);
  font-size: 1.3rem; margin: 1.5rem 0 .5rem;
}
section.footnotes li { margin: .35rem 0; }
section.footnotes p { margin: 0; }

.nota-flutuante {
  position: absolute; z-index: 40; max-width: min(24rem, 90vw);
  background: var(--superficie); color: var(--texto); border: 1px solid var(--linha);
  border-radius: var(--raio); box-shadow: 0 12px 32px rgba(0,0,0,.18);
  padding: .75rem 1rem; font-size: .95rem; line-height: 1.5;
}
.nota-flutuante p { margin: 0; }
.nota-flutuante .footnote-back { display: none; }

/* ---------- expediente ---------- */
.ficha {
  background: var(--superficie); border: 1px solid var(--linha); border-radius: var(--raio);
  box-shadow: var(--sombra); padding: 1.5rem clamp(1rem, 4vw, 2rem);
}
.ficha-instituicao { font-family: var(--fonte-titulo); font-size: 1.15rem; color: var(--verde); }
.ficha-bloco h3 {
  font-family: var(--fonte-texto); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--texto-suave); margin: 1.5rem 0 .4rem;
}
.ficha-bloco p { margin: 0; }
ul.ccp { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: .9rem 1.5rem; }
ul.ccp li { padding: 0; margin: 0; }
ul.ccp li::marker { content: none; }
.titular { display: block; font-weight: 600; }
.suplente { display: block; font-size: .92rem; color: var(--texto-suave); }
address.contato { font-style: normal; line-height: 1.8; }

/* ---------- rodapé ---------- */
.rodape {
  border-top: 1px solid var(--linha); color: var(--texto-suave); font-size: .9rem;
  text-align: center; padding: 2rem 1rem 3rem;
}
.rodape p { margin: .25rem 0; }

.voltar-topo {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 30;
  width: 2.75rem; height: 2.75rem; border-radius: 50%; display: grid; place-items: center;
  background: var(--verde); color: var(--fundo); text-decoration: none; font-size: 1.2rem;
  box-shadow: var(--sombra); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.voltar-topo.visivel { opacity: 1; pointer-events: auto; }

/* ---------- telas estreitas: sumário vira gaveta ---------- */
.botao-sumario { visibility: hidden; }
@media (max-width: 62rem) {
  .botao-sumario { visibility: visible; }
  .pagina { grid-template-columns: minmax(0, var(--largura-texto)); }
  .sumario {
    position: fixed; inset: 0 auto 0 0; width: min(20rem, 86vw); max-height: none; z-index: 60;
    background: var(--fundo); padding: 1.25rem 1rem; box-shadow: 0 0 40px rgba(0,0,0,.25);
    transform: translateX(-105%); transition: transform .25s ease;
  }
  .sumario.aberto { transform: none; }
  .fechar-sumario {
    display: block; background: none; border: 0; font-size: 1.8rem; line-height: 1;
    color: var(--texto-suave); cursor: pointer;
  }
  .veu { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55; }
  .sumario ul ul { display: block; }
  body { font-size: 1.0625rem; }
}

/* ---------- impressão (prefira o PDF, mas funciona) ---------- */
@media print {
  .topo-barra, .sumario, .veu, .voltar-topo, #progresso, .capa-acoes, .rodape a { display: none !important; }
  .topo { background: none; color: #000; }
  .topo::after { display: none; }
  .pagina { display: block; padding: 0; }
  body { background: #fff; color: #000; font-size: 11pt; }
  section.level1 { break-before: page; }
  .conteudo dl, .ficha { box-shadow: none; }
}
