/* ==========================================================================
   Teses & Dissertações — Educação e Ensino
   Identidade: azul-marinho CAPES, laranja do selo e papel quente.
   Folha de estilo única, sem dependências de build.
   ========================================================================== */

:root {
  /* Cores da marca */
  --marinho: #102448;
  --marinho-2: #0a1830;
  --marinho-3: #1b3767;
  --laranja: #e57c2b;
  --laranja-texto: #a94d0c;
  --laranja-escuro: #8a3f08;
  --laranja-claro: #fdeedd;

  /* Papel e superfícies */
  --paper: #f7f4ed;
  --paper-2: #efeae0;
  --surface: #fffdf9;
  --surface-2: #faf7f0;

  /* Texto */
  --ink: #102448;
  --ink-2: #2b3b56;
  --muted: #55617a;
  --muted-2: #677187;

  /* Traços */
  --line: #e4ddce;
  --line-forte: #d2c8b7;
  --controle: #8b8170;

  /* Apoio */
  --azul-claro: #e6ebf5;
  --azul-texto: #17305c;
  --areia: #f2ead9;
  --areia-texto: #6b4a10;
  --erro-bg: #fdf3f1;
  --erro-line: #e5c2bb;
  --erro-texto: #8a3529;

  /* Espaço, raio e sombra */
  --e-1: 4px;
  --e-2: 8px;
  --e-3: 12px;
  --e-4: 16px;
  --e-5: 24px;
  --e-6: 32px;
  --e-7: 48px;
  --e-8: 64px;

  --raio-s: 8px;
  --raio-m: 12px;
  --raio-l: 18px;
  --raio-xl: 26px;

  --sombra-1: 0 1px 2px rgba(16, 36, 72, .05);
  --sombra-2: 0 12px 36px rgba(16, 36, 72, .09);
  --sombra-3: 0 30px 80px rgba(10, 24, 48, .32);

  --display: "Sora", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --pagina: 1240px;
  --topo: 78px;
}

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

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--line-forte) var(--paper);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1100px 520px at 78% -220px, #fffdf8 0%, rgba(255, 253, 248, 0) 70%),
    radial-gradient(760px 420px at 0% 20%, rgba(229, 124, 43, .045) 0%, rgba(229, 124, 43, 0) 68%),
    var(--paper);
}

a {
  color: var(--laranja-texto);
  text-decoration: none;
  text-underline-offset: 3px;
}
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code {
  font-family: var(--mono);
  font-size: .86em;
  color: var(--marinho);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: .08em .35em;
}
::selection { background: #f7d8bb; color: var(--marinho-2); }
:target { scroll-margin-top: calc(var(--topo) + 20px); }

.wrap { width: min(var(--pagina), 100% - 40px); margin-inline: auto; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.pular {
  position: fixed; left: 12px; top: 12px; z-index: 100;
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--raio-s);
  background: var(--marinho);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  transform: translateY(-160%);
  transition: transform .15s ease;
}
.pular:focus { transform: translateY(0); }

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--marinho);
  outline-offset: 2px;
}
.topo-link:focus-visible,
.btn-buscar:focus-visible,
.btn-primario:focus-visible,
.pular:focus-visible {
  outline-color: var(--laranja);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Cabeçalho
   -------------------------------------------------------------------------- */

.topo {
  position: sticky; top: 0; z-index: 30;
  background: rgba(247, 244, 237, .92);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topo-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--e-4);
  min-height: var(--topo);
}

.marca {
  display: inline-flex; align-items: center; gap: 11px;
  min-height: 44px;
  color: var(--ink);
}
.marca:hover { text-decoration: none; }
.marca:hover .marca-nome { color: var(--laranja-texto); }
.marca-logo {
  display: block;
  width: 54px; height: 54px;
  flex: none;
  border-radius: 50%;
  filter: drop-shadow(0 2px 4px rgba(16, 36, 72, .14));
}
.marca-logo img {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
}
.marca-txt { display: flex; flex-direction: column; line-height: 1.15; }
.marca-nome {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: -.018em;
  white-space: nowrap;
  transition: color .15s ease;
}
.marca-sub { font-size: .8rem; color: var(--muted); letter-spacing: .015em; margin-top: 2px; }

.topo-nav { display: flex; align-items: center; gap: 6px; font-size: .875rem; }
.topo-nav a {
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
}
.topo-nav a:hover { color: var(--ink); text-decoration: none; background: rgba(255, 253, 249, .72); }
.topo-link {
  color: var(--ink) !important;
  border: 1px solid var(--line-forte);
  background: var(--surface);
  box-shadow: var(--sombra-1);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.topo-link:hover { border-color: var(--marinho) !important; background: var(--azul-claro) !important; color: var(--marinho) !important; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(300px, .72fr);
  align-items: center;
  gap: clamp(36px, 6vw, 84px);
  padding: 56px 0 52px;
}

.hero-texto { min-width: 0; }

.olho {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  background: none;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.35;
}
.olho-estrela { color: var(--laranja); font-size: 1rem; line-height: 1; }

.hero h1 {
  margin: 0 0 22px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 5.1vw, 4.5rem);
  line-height: 1.03;
  letter-spacing: -.035em;
  max-width: 19ch;
  text-wrap: balance;
  color: var(--marinho);
}
.hero h1 em {
  font-style: normal;
  color: var(--laranja-texto);
}

.linha-fina {
  margin: 0 0 30px;
  max-width: 56ch;
  color: var(--ink-2);
  font-size: 1.1rem;
  line-height: 1.7;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.linha-fina strong { color: var(--ink); font-weight: 600; }

.busca {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--controle);
  border-radius: 16px;
  padding: 7px 7px 7px 16px;
  box-shadow: 0 6px 22px rgba(16, 36, 72, .07);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.busca:focus-within {
  border-color: var(--marinho);
  box-shadow: 0 0 0 4px rgba(16, 36, 72, .12), 0 8px 24px rgba(16, 36, 72, .08);
}
.busca-icone { width: 21px; height: 21px; color: var(--muted); flex: none; }
.busca input {
  flex: 1; min-width: 0;
  min-height: 46px;
  border: 0; outline: 0; background: transparent;
  padding: 10px 2px;
  font: inherit; font-size: 1.04rem; color: var(--ink);
}
.busca input::placeholder { color: var(--muted-2); opacity: 1; }
.busca input::-webkit-search-cancel-button { cursor: pointer; }

.btn-buscar {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 48px;
  border: 1px solid var(--marinho);
  border-radius: 11px;
  background: var(--marinho);
  color: #fff;
  font-weight: 600; font-size: .95rem;
  padding: 0 20px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.btn-buscar svg { width: 19px; height: 19px; color: var(--laranja); }
.btn-buscar:hover { background: var(--marinho-3); border-color: var(--marinho-3); }
.btn-buscar:active { transform: translateY(1px); }

.busca-escopo {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 10px 14px;
  margin-top: 15px;
}
.busca-escopo-rotulo {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.seg-escopo {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-forte);
  border-radius: 999px;
  background: var(--surface);
}
.seg-escopo button {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: .84rem;
  padding: 0 13px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg-escopo button:hover { color: var(--marinho); }
.seg-escopo button[aria-pressed="true"] {
  background: var(--marinho);
  color: #fff;
  font-weight: 600;
}
.seg-escopo button[aria-pressed="true"]:focus-visible { outline-color: var(--laranja); }

.busca-exato {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 44px;
  font-size: .88rem;
  color: var(--ink-2);
  cursor: pointer;
}
.busca-exato input {
  width: 17px; height: 17px;
  accent-color: var(--marinho);
  cursor: pointer;
}

.sugestoes {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 6px 18px;
  margin-top: 16px;
  font-size: .95rem;
  color: var(--muted);
}
.sugestoes-rotulo { margin-right: 2px; font-weight: 500; }
.sugestoes button {
  display: inline;
  border: 0;
  background: none;
  color: var(--ink-2);
  padding: 0;
  min-height: 0;
  border-radius: 0;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-color: rgba(169, 77, 12, .35);
  text-underline-offset: 3px;
  transition: color .15s ease, text-decoration-color .15s ease;
}
.sugestoes button:hover { color: var(--laranja-texto); text-decoration-color: currentColor; }

/* Selo do hero */

.hero-selo-bloco {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  justify-self: center;
  width: 100%;
  max-width: 420px;
}

.hero-selo {
  display: block;
  width: min(380px, 100%);
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border-radius: 0;
  background: none;
  filter: drop-shadow(0 26px 46px rgba(16, 36, 72, .18));
}
.hero-selo img {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
}

.hero-legenda {
  margin: 0;
  text-align: center;
  font-size: .96rem;
  line-height: 1.5;
  color: var(--muted);
}
.hero-legenda strong {
  display: block;
  margin-bottom: 2px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.05;
  letter-spacing: -.04em;
  color: var(--marinho);
  font-variant-numeric: tabular-nums;
}
.hero-legenda span {
  display: block;
  margin-top: 4px;
  font-size: .86rem;
  color: var(--muted-2);
}

/* --------------------------------------------------------------------------
   Área de resultados + filtros
   -------------------------------------------------------------------------- */

.acervo {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  align-items: start;
  gap: var(--e-6);
  padding: 10px 0 72px;
}

.filtros-col {
  position: sticky;
  top: calc(var(--topo) + 18px);
  align-self: start;
}

.filtros-painel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--raio-l);
  box-shadow: var(--sombra-1);
  overflow: clip;
}

.filtros-resumo {
  display: none;
}

.filtros-corpo { padding: 22px; }

.filtros {
  display: grid;
  grid-template-columns: 1fr;
  gap: 19px;
}

.campo { display: block; min-width: 0; }
.campo-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campo-rotulo {
  display: block;
  margin-bottom: 8px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .055em;
  text-transform: uppercase;
  color: var(--muted);
}
.campo select,
.campo input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--controle);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .94rem;
  padding: 9px 11px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.campo select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%23102448' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
  cursor: pointer;
}
.campo select:focus,
.campo input:focus {
  outline: none;
  border-color: var(--marinho);
  box-shadow: 0 0 0 3px rgba(16, 36, 72, .14);
}
.campo input::placeholder { color: var(--muted-2); opacity: 1; }
.campo-ajuda {
  display: block;
  margin-top: 6px;
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.45;
}

.anos { display: flex; align-items: center; gap: 7px; }
.anos > span { color: var(--muted-2); font-size: .9rem; flex: none; }
.anos select {
  flex: 1;
  min-width: 0;
  padding: 9px 24px 9px 9px;
  font-size: .86rem;
  background-position: right 8px center;
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line-forte);
  border-radius: 11px;
}
.seg button {
  display: flex; align-items: center; justify-content: flex-start;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: .82rem;
  font-weight: 500;
  padding: 8px 6px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg button:hover { background: rgba(16, 36, 72, .06); color: var(--marinho); }
.seg button[aria-pressed="true"] {
  background: var(--marinho);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(16, 36, 72, .2);
}
.seg button[aria-pressed="true"]:focus-visible { outline-color: var(--laranja); }

.limpar {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line-forte);
  background: transparent;
  color: var(--ink-2);
  font-size: .86rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.limpar:hover {
  border-color: var(--marinho);
  background: var(--azul-claro);
  color: var(--marinho);
}

.dica {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: var(--raio-s);
  background: var(--laranja-claro);
  border: 1px solid #f0cfae;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--laranja-escuro);
}

/* --------------------------------------------------------------------------
   Resultados
   -------------------------------------------------------------------------- */

.resultados { min-width: 0; padding-top: 2px; }

.cabecalho-resultados {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line-forte);
}
.cabecalho-txt { min-width: 0; }
.resultados-olho {
  margin: 0 0 5px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--laranja-texto);
}
#titulo-resultados {
  margin: 0 0 5px;
  font-family: var(--display);
  font-size: clamp(1.55rem, 2.3vw, 2rem);
  font-weight: 600;
  letter-spacing: -.025em;
  line-height: 1.18;
  color: var(--marinho);
  overflow-wrap: break-word;
}
.subtitulo { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.subtitulo strong { color: var(--ink-2); font-weight: 600; }

.btn-csv {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px;
  border: 1px solid var(--controle);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 9px;
  padding: 0 15px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.btn-csv svg { width: 17px; height: 17px; }
.btn-csv:hover { border-color: var(--marinho); background: var(--azul-claro); color: var(--marinho); }
.btn-csv:disabled { opacity: .55; cursor: default; }

.lista { display: flex; flex-direction: column; gap: 15px; }

/* --------------------------------------------------------------------------
   Cartão de resultado
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--raio-l);
  padding: 22px 24px 16px;
  box-shadow: var(--sombra-1);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
  animation: surgir .28s ease both;
}
.card:hover {
  border-color: var(--line-forte);
  box-shadow: var(--sombra-2);
  transform: translateY(-1px);
}

.card-titulo {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -.015em;
  color: var(--marinho);
  overflow-wrap: break-word;
}
.card-titulo a { color: inherit; }
.card-titulo a:hover { color: var(--laranja-texto); text-decoration: none; }

.card-meta {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 5px 14px;
  margin-bottom: 11px;
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.45;
}
.card-meta > span { min-width: 0; }
.card-meta .autor { color: var(--ink-2); }
.card-meta .area { color: var(--muted); }

.selo {
  display: inline-flex; align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .005em;
  line-height: 1.3;
  white-space: nowrap;
}
.selo--mestrado { background: var(--azul-claro); color: var(--azul-texto); }
.selo--doutorado { background: var(--marinho); color: #fff; }
.selo--profissional { background: var(--laranja-claro); color: var(--laranja-escuro); }

.card-resumo {
  margin: 0;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.64;
  min-height: calc(3 * 1.64em);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.card-resumo.sem-resumo {
  color: var(--muted);
  font-style: normal;
}

.card-pe {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.link-capes {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px;
  font-size: .83rem;
  font-weight: 600;
  color: var(--laranja-texto);
  letter-spacing: .002em;
  white-space: nowrap;
}
.link-capes:hover { text-decoration: none; color: var(--laranja-escuro); }
.link-capes span { transition: transform .15s ease; }
.link-capes:hover span { transform: translate(1px, -1px); }

.btn-detalhes {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line-forte);
  background: transparent;
  color: var(--ink-2);
  font-size: .83rem;
  font-weight: 500;
  padding: 0 14px;
  border-radius: 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-detalhes:hover { background: var(--azul-claro); border-color: var(--marinho); color: var(--marinho); }

/* esqueleto do resumo enquanto o detalhe não chega */
.esqueleto { display: flex; flex-direction: column; gap: 7px; min-height: calc(3 * 1.64em); }
.esqueleto i {
  display: block; height: 10px; border-radius: 5px;
  background: linear-gradient(90deg, #eee8dc 25%, #f9f6ef 37%, #eee8dc 63%);
  background-size: 400% 100%;
  animation: brilho 1.25s ease infinite;
}
.esqueleto i:nth-child(2) { width: 94%; }
.esqueleto i:nth-child(3) { width: 58%; }

.card.placeholder { animation: none; }
.card.placeholder .esqueleto { min-height: 0; }

/* --------------------------------------------------------------------------
   Estados, paginação e avisos
   -------------------------------------------------------------------------- */

.estado {
  margin: 26px 0;
  padding: 40px 28px;
  text-align: center;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--raio-l);
  background: var(--surface);
  box-shadow: var(--sombra-1);
}
.estado::before {
  content: "★";
  display: grid; place-items: center;
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--laranja-claro);
  color: var(--laranja-texto);
  font-size: 1.4rem;
  line-height: 1;
}
.estado.erro::before { content: "!"; background: #f9e4df; color: var(--erro-texto); font-family: var(--display); font-weight: 700; }
.estado h3 {
  margin: 0 0 7px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.26rem;
  letter-spacing: -.02em;
  color: var(--marinho);
}
.estado p {
  max-width: 56ch;
  margin: 0 auto 18px;
  font-size: .92rem;
  line-height: 1.6;
  color: var(--muted);
}
.estado.erro { border-color: var(--erro-line); background: var(--erro-bg); color: var(--erro-texto); }
.estado.erro h3 { color: var(--erro-texto); }
.estado.erro p { color: var(--erro-texto); }
.estado button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  border: 1px solid var(--controle);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 9px;
  padding: 0 16px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.estado button:hover { border-color: var(--marinho); background: var(--azul-claro); color: var(--marinho); }
.estado.erro button { border-color: var(--erro-line); color: var(--erro-texto); }
.estado.erro button:hover { background: #fff; border-color: var(--erro-texto); color: var(--erro-texto); }

.paginacao {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.paginacao button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  border: 1px solid var(--controle);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 9px;
  padding: 0 16px;
  font-size: .86rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.paginacao button:hover:not(:disabled) { border-color: var(--marinho); background: var(--azul-claro); color: var(--marinho); }
.paginacao button:disabled { opacity: .42; cursor: default; }
.pagina-atual { font-size: .86rem; color: var(--muted); padding: 0 6px; }
.pagina-atual strong { color: var(--ink-2); }

/* --------------------------------------------------------------------------
   Diálogo de detalhes
   -------------------------------------------------------------------------- */

.dialog {
  width: min(880px, calc(100% - 32px));
  max-height: 90dvh;
  padding: 0;
  border: 0;
  border-radius: var(--raio-l);
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.dialog::backdrop {
  background: rgba(10, 24, 48, .62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.dialog-card {
  background: var(--surface);
  border-radius: var(--raio-l);
  padding: 26px 32px 0;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--sombra-3);
}

.dialog-topo {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px;
}
.d-badges { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; font-size: .82rem; color: var(--muted); }
.d-badges .selo { margin-right: 2px; }
.dialog-fechar {
  flex: none;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border: 1px solid var(--line-forte);
  background: var(--surface);
  border-radius: 50%;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.dialog-fechar svg { width: 20px; height: 20px; }
.dialog-fechar:hover { border-color: var(--marinho); background: var(--azul-claro); color: var(--marinho); }

#d-titulo {
  margin: 14px 0 7px;
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.6vw, 1.72rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -.025em;
  color: var(--marinho);
  text-wrap: pretty;
  overflow-wrap: break-word;
}
.d-sub { margin: 0 0 18px; color: var(--muted); font-size: .96rem; line-height: 1.5; }

.meta-grade {
  display: grid;
  grid-template-columns: 172px 1fr;
  gap: 10px 20px;
  margin: 0 0 24px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: .94rem;
}
.meta-grade dt {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.45;
  padding-top: 2px;
}
.meta-grade dd { margin: 0; color: var(--ink-2); line-height: 1.55; overflow-wrap: break-word; }
.meta-grade a { color: var(--laranja-texto); }

.d-secao { margin: 0 0 22px; }
.d-secao h3 {
  margin: 0 0 9px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .075em;
  text-transform: uppercase;
  color: var(--muted);
}
.d-resumo {
  margin: 0;
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-2);
  white-space: pre-line;
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.d-palavras { display: flex; flex-wrap: wrap; gap: 7px; }
.d-palavras span {
  border: 1px solid var(--line-forte);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: .8rem;
  color: var(--ink-2);
}

.d-acoes {
  position: sticky;
  bottom: 0;
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 10px;
  margin: 10px -32px 0;
  padding: 14px 32px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--surface) 72%, rgba(255, 253, 249, .95));
  border-top: 1px solid var(--line);
}
.btn-primario {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 46px;
  background: var(--marinho);
  color: #fff;
  border: 1px solid var(--marinho);
  border-radius: 9px;
  padding: 0 17px;
  font-size: .88rem;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease;
}
.btn-primario:hover { background: var(--marinho-3); border-color: var(--marinho-3); text-decoration: none; }
.btn-secundario {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--controle);
  border-radius: 9px;
  padding: 0 15px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.btn-secundario:hover { border-color: var(--marinho); background: var(--azul-claro); color: var(--marinho); }

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

.rodape {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 56px 0 64px;
}
.rodape-grid {
  display: grid;
  grid-template-columns: 1.5fr .85fr;
  gap: 64px;
}
.rodape-titulo { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rodape-logo {
  display: block;
  width: 42px; height: 42px;
  flex: none;
  border-radius: 50%;
}
.rodape-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.rodape h2, .rodape h3 {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--marinho);
}
.rodape h2 { margin: 0; font-size: 1.35rem; }
.rodape h3 { margin: 0 0 12px; font-size: 1.12rem; }
.rodape p {
  margin: 0 0 13px;
  font-size: .94rem;
  line-height: 1.72;
  color: var(--muted);
  max-width: 68ch;
  text-align: justify;
  text-align-last: left;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}
.rodape p strong { color: var(--ink-2); font-weight: 600; }
.rodape p a {
  text-decoration: underline;
  text-decoration-color: rgba(169, 77, 12, .38);
  text-underline-offset: 2px;
}
.rodape p a:hover { text-decoration-color: currentColor; }
.rodape .aviso { font-size: .82rem; color: var(--muted); }
.rodape ul { margin: 0 0 16px; padding-left: 19px; }
.rodape li { font-size: .86rem; color: var(--muted); margin-bottom: 6px; line-height: 1.62; }
.rodape li em { color: var(--ink-2); font-style: normal; }
.rodape-nota { font-size: .8rem !important; color: var(--muted) !important; }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 32px);
  background: var(--marinho);
  color: #fff;
  border: 1px solid rgba(229, 124, 43, .7);
  font-size: .86rem;
  line-height: 1.45;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(10, 24, 48, .28);
  animation: subir .2s ease both;
}

.noscript { padding: 24px; text-align: center; color: var(--erro-texto); }

/* --------------------------------------------------------------------------
   Animações
   -------------------------------------------------------------------------- */

@keyframes surgir {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes brilho {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}
@keyframes subir {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* --------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .hero { grid-template-columns: minmax(0, 1.1fr) minmax(330px, .9fr); gap: 40px; }
}

/* Sidebar vira painel recolhível */
@media (max-width: 980px) {
  :root { --topo: 68px; }

  .hero {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 44px 0 40px;
  }
  .hero h1 { max-width: 22ch; }
  /* No tablet/celular o selo grande sai de cena para a busca ganhar a dobra;
     o selo continua no cabeçalho e no rodapé. */
  .hero-selo-bloco { display: none; }

  .acervo { grid-template-columns: 1fr; gap: 22px; padding-bottom: 56px; }
  .filtros-col { position: static; }

  .filtros-painel { border-radius: var(--raio-m); }
  .filtros-resumo {
    display: flex; align-items: center; gap: 12px;
    min-height: 56px;
    padding: 8px 18px;
    cursor: pointer;
    list-style: none;
    user-select: none;
  }
  .filtros-resumo::-webkit-details-marker { display: none; }
  .filtros-resumo:hover { background: var(--surface-2); }
  .filtros-resumo-icone {
    display: grid; place-items: center;
    width: 34px; height: 34px; flex: none;
    border-radius: 8px;
    background: var(--azul-claro);
    color: var(--marinho);
  }
  .filtros-resumo-icone svg { width: 19px; height: 19px; }
  .filtros-resumo-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .filtros-resumo-titulo { font-family: var(--display); font-size: .92rem; font-weight: 600; color: var(--marinho); }
  .filtros-resumo-dica { font-size: .78rem; color: var(--muted); }
  .filtros-resumo-seta {
    width: 20px; height: 20px; margin-left: auto; flex: none;
    color: var(--muted);
    transition: transform .2s ease;
  }
  .filtros-painel[open] .filtros-resumo-seta { transform: rotate(180deg); }
  .filtros-corpo {
    padding: 4px 18px 20px;
    border-top: 1px solid var(--line);
  }
  .filtros {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    padding-top: 16px;
  }
  .campo-area { grid-column: 1 / -1; }
  .campo-duplo { grid-column: 1 / -1; }
  .campo-ies { grid-column: 1 / -1; }
  .limpar { grid-column: 1 / -1; }
  .seg { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .seg button { justify-content: center; text-align: center; padding-inline: 8px; }

  .rodape-grid { grid-template-columns: 1fr; gap: 38px; }
}

@media (max-width: 620px) {
  .wrap { width: calc(100% - 32px); }

  .topo-in { gap: 8px; }
  .marca { gap: 8px; }
  .marca-logo { width: 46px; height: 46px; }
  .marca-nome { font-size: .92rem; }
  .marca-sub { display: none; }
  .topo-nav { display: none; }

  .hero { padding: 28px 0 30px; gap: 0; }
  .olho { font-size: .72rem; letter-spacing: .045em; margin-bottom: 14px; }
  .hero h1 { font-size: clamp(1.9rem, 9.2vw, 2.45rem); max-width: none; margin-bottom: 16px; }
  .linha-fina { font-size: .97rem; line-height: 1.66; margin-bottom: 24px; }

  .busca { flex-wrap: wrap; padding: 10px; gap: 8px; border-radius: 14px; }
  .busca-icone { margin-left: 4px; }
  .busca input { flex-basis: calc(100% - 40px); min-height: 44px; padding: 6px 0; font-size: 1rem; }
  .btn-buscar { width: 100%; min-height: 48px; }

  .busca-escopo { gap: 8px 10px; }
  .seg-escopo { width: 100%; }
  .seg-escopo button { flex: 1; padding: 0 6px; font-size: .78rem; }
  .busca-exato { min-height: 40px; }

  .sugestoes { gap: 4px 14px; font-size: .9rem; }
  .sugestoes-rotulo { flex-basis: auto; margin-bottom: 0; }
  .sugestoes button { font-size: .9rem; padding: 0; }

  .acervo { padding-top: 2px; }
  .filtros-corpo { padding-inline: 16px; }
  .filtros { grid-template-columns: 1fr; }
  .campo-area { grid-column: auto; }
  .campo-ies { grid-column: auto; }
  .limpar { grid-column: auto; }
  .seg { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  .cabecalho-resultados { align-items: flex-start; gap: 13px; }
  .btn-csv { align-self: flex-start; }
  .btn-csv span { display: none; }
  .btn-csv { padding: 0 13px; }

  .card { padding: 18px 16px 14px; border-radius: var(--raio-m); }
  .card-titulo { font-size: 1.08rem; line-height: 1.4; }
  .card-meta { font-size: .86rem; }
  .card-resumo { font-size: .96rem; }
  .card-pe { gap: 8px; }
  .link-capes { font-size: .81rem; }
  .btn-detalhes { font-size: .81rem; padding: 0 12px; }

  .estado { padding: 32px 18px; }

  .dialog { width: calc(100% - 16px); max-height: 92dvh; }
  .dialog-card { padding: 20px 18px 0; max-height: 92dvh; }
  .d-badges { font-size: .78rem; }
  #d-titulo { font-size: 1.28rem; }
  .meta-grade { grid-template-columns: 1fr; gap: 2px 0; }
  .meta-grade dt { padding-top: 10px; }
  .d-acoes { margin: 8px -18px 0; padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); }
  .btn-primario, .btn-secundario { width: 100%; }

  .rodape { padding: 40px 0 48px; }
  .rodape-grid { gap: 30px; }
  .rodape p { font-size: .86rem; }
  .rodape h2 { font-size: 1.24rem; }
}

@media (max-width: 380px) {
  .marca-nome { font-size: .8rem; }
  .topo-link { font-size: .7rem; padding: 0 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* O atributo hidden precisa vencer os display definidos nas classes. */
[hidden] { display: none !important; }

/* Âncoras não ficam escondidas sob o cabeçalho fixo. */
#resultados, #sobre { scroll-margin-top: calc(var(--topo) + 20px); }

/* No desktop os filtros ficam sempre visíveis, mesmo com <details> fechado. */
@media (min-width: 981px) {
  .filtros-resumo { display: none; }
  .filtros-painel:not([open]) .filtros-corpo { display: block; }
}

/* Ações do cartão: catálogo, PDF e detalhes */
.card-pe-acoes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.link-pdf {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--controle);
  border-radius: 9px;
  color: var(--marinho);
  font-size: .83rem;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.link-pdf:hover {
  border-color: var(--marinho);
  background: var(--azul-claro);
  text-decoration: none;
}
.btn-secundario { text-decoration: none; }
.btn-secundario:hover { text-decoration: none; }
