/* Social Acceptance Evidence Map — stylesheet.
   Identity follows the OTIC site: navy (#002254), yellow (#fecb01) and white.
   Yellow is the brand accent (active tab, focus, highlights); it never encodes
   data. Relation types use the Okabe-Ito palette, which stays distinguishable
   under the common colour-vision deficiencies. */

:root {
  --navy: #002254;
  --navy-d: #001c46;
  --yellow: #fecb01;
  --yellow-s: #fff6cc;

  --bg: #f4f6fa;
  --surface: #ffffff;
  --alt: #eef1f6;
  --ink: #0e1a2e;
  --soft: #3d4a5f;
  --faint: #5f6b7d;
  --line: #d7dde7;
  --line-b: #e6eaf1;
  --acc: #0b4f9c;
  --acc-s: #e3edf9;

  --r-enables: #009e73;
  --r-influences: #0072b2;
  --r-constrains: #d55e00;
  --r-contested-by: #cc79a7;
  --r-supported-by: #56b4e9;
  --r-relates-to: #8a919c;
  --barra: #0b4f9c;
  --calor: 11, 79, 156;

  --radius: 6px;
  --ui: "Open Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --tit: "Montserrat", "Segoe UI", Arial, sans-serif;
  --sombra: 0 1px 3px rgba(0, 34, 84, .08), 0 1px 2px rgba(0, 34, 84, .05);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1424; --surface: #111e33; --alt: #18273f;
    --ink: #e8edf5; --soft: #c0c9d6; --faint: #93a0b3;
    --line: #26385a; --line-b: #1d2d49;
    --acc: #8ab8f0; --acc-s: #16304f;
    --yellow-s: #3a3210;
    --barra: #5b9be0; --calor: 91, 155, 224;
    --sombra: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1424; --surface: #111e33; --alt: #18273f;
  --ink: #e8edf5; --soft: #c0c9d6; --faint: #93a0b3;
  --line: #26385a; --line-b: #1d2d49;
  --acc: #8ab8f0; --acc-s: #16304f;
  --yellow-s: #3a3210;
  --barra: #5b9be0; --calor: 91, 155, 224;
  --sombra: none;
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.55 var(--ui); }
a { color: var(--acc); }
h1, h2, h3 { font-family: var(--tit); }
h1 { font-size: 1.55rem; margin: .2rem 0 .4rem; font-weight: 700; }
h2 { font-size: 1.12rem; margin: 1.2rem 0 .5rem; font-weight: 600; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.sub { color: var(--soft); max-width: 64rem; margin: 0 0 1.2rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------ header */
header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
.topo {
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
  max-width: 1320px; margin: 0 auto; padding: .7rem 1.25rem .55rem;
}
.logos { display: flex; align-items: center; gap: .9rem; }
.logos img { display: block; }
.logo-usp { height: 30px; width: auto; }
.logo-otic { height: 38px; width: auto; }
.divisor { width: 1px; height: 34px; background: rgba(255,255,255,.35); }
.marca {
  display: flex; flex-direction: column; text-decoration: none; color: #fff;
  border-left: 4px solid var(--yellow); padding-left: .8rem; line-height: 1.2;
}
.marca-sup { color: var(--yellow); font-family: var(--tit); font-weight: 600; font-size: .82rem; letter-spacing: .04em; }
.marca-tit { font-family: var(--tit); font-weight: 700; font-size: 1.15rem; }
.cobertura { margin-left: auto; font-size: .82rem; color: #d5dcea; max-width: 30rem; }
.cobertura b { color: var(--yellow); }
.abas {
  display: flex; gap: .1rem; overflow-x: auto;
  max-width: 1320px; margin: 0 auto; padding: 0 1.25rem;
}
.abas a {
  padding: .5rem .8rem; text-decoration: none; color: #c9d3e6; font-family: var(--tit);
  font-weight: 600; font-size: .9rem; border-bottom: 3px solid transparent; white-space: nowrap;
}
.abas a:hover { color: #fff; }
.abas a[aria-selected="true"] { color: #fff; border-bottom-color: var(--yellow); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
.clicavel:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }

main { max-width: 1320px; margin: 0 auto; padding: 1.25rem; }
.tela[hidden] { display: none; }
.hero h1 { font-size: 1.85rem; }

/* ------------------------------------------------------------ panels */
.painel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--sombra); min-width: 0; margin-bottom: 1rem;
}
.colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.rotulo {
  font-family: var(--tit); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--faint); margin: 0 0 .8rem; font-weight: 700;
}
.dica { color: var(--faint); font-size: .84rem; margin: .7rem 0 0; }
.vazio { color: var(--faint); font-style: italic; padding: 1rem; text-align: center; }
.kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 1rem; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--yellow);
  border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--sombra);
}
.kpi b { display: block; font-family: var(--tit); font-size: 1.9rem; line-height: 1.1; color: var(--navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .kpi b { color: #fff; } }
:root[data-theme="dark"] .kpi b { color: #fff; }
.kpi span { color: var(--soft); font-size: .88rem; }

/* ------------------------------------------------------------ bars */
.barra-item { display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr; gap: .6rem; align-items: center; margin: .28rem 0; }
.barra-item .nome { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-item button.nome, .barra-item a.nome { background: none; border: 0; padding: 0; font: inherit; color: var(--acc); cursor: pointer; text-align: left; text-decoration: none; }
.barra-medida { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.barra-trilho { flex: 1; display: flex; gap: 2px; height: 15px; min-width: 0; }
.seg { height: 100%; min-width: 2px; }
.seg:first-child { border-radius: 3px 0 0 3px; }
.seg:last-child { border-radius: 0 3px 3px 0; }
.seg:only-child { border-radius: 3px; }
.barra-medida .n { font-variant-numeric: tabular-nums; color: var(--soft); font-size: .88rem; min-width: 2rem; }
.barra-unica { background: var(--barra); }
.st-Affirmed { background: var(--acc); }
.st-Hypothetical { background: repeating-linear-gradient(135deg, var(--acc) 0 4px, transparent 4px 7px); box-shadow: inset 0 0 0 1.5px var(--acc); }
.st-Investigated { background: repeating-linear-gradient(90deg, var(--acc) 0 2px, transparent 2px 5px); box-shadow: inset 0 0 0 1.5px var(--acc); }
.st-Negated { background: var(--r-constrains); }
.st-Inconclusive { background: var(--r-relates-to); }

.legenda { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .84rem; color: var(--soft); margin-top: .7rem; }
.legenda .amostra { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: .35rem; }
.legenda .traco { display: inline-block; width: 26px; height: 0; vertical-align: 3px; margin-right: .35rem; border-top: 3px solid; }

.contexto-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem 1.4rem; }
.contexto-grid h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin: .4rem 0 .3rem; }
.contexto-grid h3 small { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ------------------------------------------------------------ chips, badges */
.chip {
  display: inline-flex; align-items: baseline; gap: .3rem; padding: .12rem .55rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--alt); font-size: .85rem; margin: .15rem .2rem .15rem 0;
  color: var(--ink); text-decoration: none;
}
.chip b { font-variant-numeric: tabular-nums; color: var(--soft); font-weight: 600; }
button.chip, a.chip { cursor: pointer; font-family: inherit; }
button.chip[aria-pressed="true"] { background: var(--acc-s); border-color: var(--acc); color: var(--acc); }
.selo {
  display: inline-block; font-size: .74rem; font-weight: 700; letter-spacing: .02em; padding: .05rem .45rem;
  border-radius: 4px; color: var(--ink); background: var(--alt); white-space: nowrap; border-left: 4px solid var(--line);
}
.selo.rel-ENABLES { border-left-color: var(--r-enables); }
.selo.rel-INFLUENCES { border-left-color: var(--r-influences); }
.selo.rel-CONSTRAINS { border-left-color: var(--r-constrains); }
.selo.rel-CONTESTED-BY { border-left-color: var(--r-contested-by); }
.selo.rel-SUPPORTED-BY { border-left-color: var(--r-supported-by); }
.selo.rel-RELATES-TO { border-left-color: var(--r-relates-to); }
.selo.status { border-left-color: var(--acc); }
.selo.status-Hypothetical { border-left-style: dashed; }
.selo.status-Investigated { border-left-style: dotted; }
.selo.status-Negated, .selo.status-Inconclusive { border-left-color: var(--r-relates-to); }
.selo.zona { border-left-color: var(--yellow); }
.selo.ia { border-left-color: var(--yellow); background: var(--yellow-s); }
.sinal { font-weight: 700; font-family: var(--tit); }
.sinal.pos { color: var(--r-enables); }
.sinal.neg { color: var(--r-constrains); }

/* ------------------------------------------------------------ factors and relations */
.fator { color: var(--acc); text-decoration: none; font-weight: 600; cursor: pointer; }
.fator:hover { text-decoration: underline; }
.cadeia { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; }
.cadeia .rel { font-size: .84rem; white-space: nowrap; font-weight: 600; }
.cadeia .rel.r-ENABLES { color: var(--r-enables); }
.cadeia .rel.r-INFLUENCES { color: var(--r-influences); }
.cadeia .rel.r-CONSTRAINS { color: var(--r-constrains); }
.cadeia .rel.r-CONTESTED-BY { color: var(--r-contested-by); }
.cadeia .rel.r-SUPPORTED-BY { color: #2f8fcb; }
.cadeia .rel.r-RELATES-TO { color: var(--r-relates-to); }

/* evidence card */
.ev { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: .7rem .9rem; margin: .5rem 0; }
.ev-topo { display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-items: center; font-size: .86rem; }
.ev-ref { font-weight: 700; }
.ev blockquote { margin: .5rem 0 .3rem; padding-left: .7rem; border-left: 3px solid var(--yellow); font-size: .97rem; }
.ev .bundle { border-top: 1px dashed var(--line-b); padding-top: .45rem; margin-top: .45rem; }
.ev blockquote + .bundle { border-top: 0; padding-top: 0; }
ul.mini { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
ul.mini li { margin: .2rem 0; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.ev .linha-b { display: flex; flex-wrap: wrap; gap: .3rem .6rem; align-items: center; }
.ev .cond { font-size: .85rem; color: var(--soft); margin: .2rem 0 0; }
.ev .cond b { color: var(--faint); font-weight: 600; }
.ev .insight { font-size: .9rem; margin: .3rem 0 0; }
.ev details { margin-top: .3rem; font-size: .86rem; color: var(--soft); }
.ev summary { cursor: pointer; color: var(--faint); }
.ev mark { background: var(--yellow-s); color: inherit; padding: 0 .1rem; border-radius: 2px; }

/* ------------------------------------------------------------ list + detail */
.lista-detalhe { display: grid; grid-template-columns: 330px 1fr; gap: 1.2rem; align-items: start; }
.lista {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  position: sticky; top: 7rem; max-height: calc(100vh - 8.5rem); overflow: auto;
}
.lista ul { list-style: none; margin: 0; padding: 0; }
.lista li button {
  display: flex; justify-content: space-between; gap: .5rem; width: 100%; text-align: left;
  padding: .45rem .8rem; border: 0; border-bottom: 1px solid var(--line-b); background: none;
  color: var(--ink); font: inherit; font-size: .92rem; cursor: pointer;
}
.lista li button:hover { background: var(--alt); }
.lista li button[aria-current="true"] { background: var(--acc-s); color: var(--acc); box-shadow: inset 4px 0 0 var(--yellow); }
.lista li small { color: var(--faint); white-space: nowrap; }
.lista li .t2 { display: block; font-size: .8rem; color: var(--faint); }
.lista .grupo { padding: .5rem .8rem .2rem; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); font-weight: 700; }
.busca { display: block; padding: .6rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.busca input, .busca-curta {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--bg); color: var(--ink); font: inherit;
}
.busca-curta { width: auto; min-width: 14rem; }
.busca-filtros { display: flex; flex-wrap: wrap; gap: .3rem; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
.busca-filtros select { flex: 1 1 45%; min-width: 0; font-size: .85rem; }
.contagem { color: var(--faint); font-size: .84rem; margin: .4rem .8rem; }
.filtros .contagem { margin: 0 0 0 auto; }
.detalhe { min-width: 0; }
.cabeca { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1rem; }
.cabeca h1 { margin: 0; }
.meta { color: var(--faint); font-size: .88rem; }
.definicao { font-size: 1.03rem; margin: .6rem 0; }
.ficha { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; font-size: .92rem; margin: .6rem 0 0; }
.ficha dt { color: var(--faint); }
.ficha dd { margin: 0; }
.polos { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .9rem; }
.polos .pa { font-weight: 700; }
.mais { display: block; width: 100%; margin: .6rem 0; padding: .5rem; border: 1px dashed var(--line); background: var(--surface); color: var(--acc); font: inherit; cursor: pointer; border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid var(--line-b); vertical-align: top; }
th { color: var(--faint); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }

/* relation groups on the factor page */
.grupo-rel > summary { cursor: pointer; padding: .45rem 0; font-weight: 600; list-style: none; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.grupo-rel > summary::-webkit-details-marker { display: none; }
.grupo-rel > summary::before { content: "▸"; color: var(--faint); }
.grupo-rel[open] > summary::before { content: "▾"; }
.grupo-rel { border-top: 1px solid var(--line-b); }
.grupo-rel .corpo { padding-left: 1rem; }

/* ------------------------------------------------------------ graph */
.grafo { height: 440px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.grafo-grande { height: 660px; }
.mapa-area { display: grid; grid-template-columns: 1fr 320px; gap: 1rem; }
.mapa-lado { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; max-height: 660px; overflow: auto; }
.grafo-controles { display: flex; gap: .4rem; justify-content: flex-end; margin-bottom: .3rem; }
.grafo-controles button, .limpar, .voltar {
  font: inherit; font-size: .82rem; padding: .25rem .6rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--acc); cursor: pointer;
}
.filtros { display: flex; flex-wrap: wrap; gap: .45rem .8rem; align-items: center; margin-bottom: .9rem; }
.grupo-filtro { display: flex; flex-wrap: wrap; gap: .2rem; align-items: center; }
.grupo-filtro > span { font-size: .76rem; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; margin-right: .3rem; font-weight: 700; }
select { font: inherit; padding: .3rem .4rem; border-radius: 4px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.check { font-size: .88rem; color: var(--soft); display: inline-flex; gap: .3rem; align-items: center; }

/* ------------------------------------------------------------ themes, heat map */
.tema-linha { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr auto; gap: .6rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid var(--line-b); }
.tema-linha button { background: none; border: 0; font: inherit; color: var(--acc); cursor: pointer; text-align: left; padding: 0; font-weight: 600; }
.calor-topo { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.calor-rolagem { overflow-x: auto; }
table.calor { width: auto; min-width: 100%; }
table.calor th { white-space: nowrap; }
table.calor th.vert { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .74rem; text-transform: none; letter-spacing: 0; padding: .4rem .2rem; }
table.calor td.c { text-align: center; min-width: 2.1rem; font-variant-numeric: tabular-nums; cursor: pointer; font-size: .85rem; }
table.calor td.c.zero { cursor: default; color: var(--line); }
table.calor td.c.ativa { outline: 2px solid var(--yellow); outline-offset: -2px; }
.legenda-calor { display: flex; gap: .3rem; align-items: center; font-size: .78rem; color: var(--faint); }
.legenda-calor span { display: inline-block; width: 20px; height: 12px; border-radius: 2px; }

/* ------------------------------------------------------------ running text */
.texto-corrido { max-width: 56rem; }
.texto-corrido p, .texto-corrido li { color: var(--soft); }
.texto-corrido td, .texto-corrido th { color: var(--ink); }

.dica-flutuante {
  position: fixed; z-index: 50; pointer-events: none; max-width: 24rem; white-space: pre-line;
  background: var(--navy); color: #fff; font-size: .84rem; padding: .45rem .65rem;
  border-radius: 4px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); border-left: 3px solid var(--yellow);
}

footer { background: var(--navy); color: #c9d3e6; font-size: .84rem; margin-top: 2rem; }
footer > * { max-width: 1320px; margin: 0 auto; padding: .4rem 1.25rem; }
footer a { color: #fff; }
.rodape-marca { display: flex; gap: .9rem; align-items: stretch; padding-top: 1.2rem; }
.rodape-marca .barra-amarela { width: 4px; background: var(--yellow); flex: none; }
.rodape-marca p { margin: 0; }
footer > p { padding-bottom: 1.4rem; color: #9fb0cc; }
.aviso { background: var(--yellow-s); padding: .8rem; }

/* ------------------------------------------------------------ narrow screens */
@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .contexto-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  header { position: static; }
  .colunas, .lista-detalhe, .mapa-area { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .lista { position: static; max-height: 360px; }
  .cobertura { margin-left: 0; }
  .grafo-grande { height: 480px; }
  .contexto-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  main { padding: 1rem; }
  .barra-item { grid-template-columns: 7rem 1fr; }
  .hero h1 { font-size: 1.4rem; }
  .logo-otic { height: 30px; }
  .logo-usp { height: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
