/* roteiro.css — estilo dos widgets do Roteiro de Estudos.
 * Usa os tokens de www/estilo.css (cores de R/tema.R), com valores de reserva para a página
 * estática do Bookdown, que não carrega estilo.css. */

.rot-widget {
  --rot-marca: var(--marca, #0f3d5c);
  --rot-tinta: var(--tinta, #0b0b0b);
  --rot-tinta2: var(--tinta2, #52514e);
  --rot-suave: var(--suave, #8a8983);
  --rot-grade: var(--grade, #e9e8e4);
  --rot-fundo: var(--fundo, #fcfcfb);
  --rot-papel: var(--papel, #ffffff);
  --rot-azul: var(--azul, #2a78d6);
  --rot-laranja: var(--laranja, #eb6834);
  --rot-agua: var(--agua, #1baf7a);
  --rot-amarelo: var(--amarelo, #eda100);
  --rot-vermelho: var(--vermelho, #e34948);
  --rot-referencia: var(--referencia, #a3a29c);
  --rot-creme: var(--creme, #f4f1ea);

  color: var(--rot-tinta);
  background: var(--rot-papel);
  border: 1px solid var(--rot-grade);
  border-left: 4px solid var(--rot-marca);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 20px 0;
  font-size: 15px;
  line-height: 1.5;
  max-width: 100%;
  box-sizing: border-box;
}
.rot-widget *, .rot-widget *::before, .rot-widget *::after { box-sizing: border-box; }
.rot-widget [hidden] { display: none !important; }

.rot-titulo { margin: 0 0 12px; font-size: 1.1em; color: var(--rot-marca); }
.rot-widget h4 { margin: 14px 0 6px; font-size: 1em; }
.rot-corpo > * + * { margin-top: 12px; }

/* Previsão */
.rot-previsao {
  background: var(--rot-creme);
  border-radius: 6px;
  padding: 10px 14px;
}
.rot-previsao-texto { margin: 0 0 6px; font-weight: 600; }
.rot-pergunta, .rot-escolha, .rot-item, .rot-eixo {
  border: 0; margin: 6px 0; padding: 0; min-width: 0;
}
.rot-pergunta legend, .rot-escolha legend, .rot-item legend, .rot-eixo legend { padding: 0; font-weight: 600; }
.rot-opcao { display: inline-flex; align-items: center; gap: 4px; margin: 2px 14px 2px 0; cursor: pointer; }
.rot-texto-aluno {
  width: 100%; font: inherit; padding: 6px 8px; margin-top: 4px;
  border: 1px solid var(--rot-grade); border-radius: 4px; background: var(--rot-papel); color: inherit;
}

/* Botões */
.rot-botoes, .rot-acoes { display: flex; flex-wrap: wrap; gap: 8px; }
.rot-botao {
  font: inherit; font-size: 0.95em;
  padding: 6px 12px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--rot-marca); background: var(--rot-papel); color: var(--rot-marca);
  text-decoration: none; display: inline-block;
}
.rot-botao:hover:not([disabled]) { background: var(--rot-creme); }
.rot-botao-principal { background: var(--rot-marca); color: #fff; }
.rot-botao-principal:hover:not([disabled]) { background: var(--rot-azul); }
.rot-botao[aria-pressed="true"] { background: var(--rot-azul); border-color: var(--rot-azul); color: #fff; }
.rot-botao[disabled] { opacity: 0.45; cursor: not-allowed; }
.rot-botao-pequeno { padding: 3px 9px; font-size: 0.85em; }
/* foco: azul-escuro da marca (o amarelo dava 2,1:1 contra o fundo, abaixo dos 3:1 da WCAG 1.4.11; R7) */
.rot-widget :focus-visible { outline: 3px solid var(--rot-marca); outline-offset: 2px; }

/* Entradas numéricas */
.rot-entradas { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 20px; }
.rot-campo label { display: block; font-size: 0.9em; color: var(--rot-tinta2); }
.rot-campo-controles { display: flex; align-items: center; gap: 8px; }
.rot-campo-controles input[type="range"] { flex: 1; accent-color: var(--rot-marca); min-width: 0; }
.rot-numero {
  width: 6.5em; font: inherit; text-align: right; padding: 4px 6px;
  border: 1px solid var(--rot-grade); border-radius: 4px; background: var(--rot-papel); color: inherit;
  font-variant-numeric: tabular-nums;
}
.rot-numero[aria-invalid="true"] { border-color: var(--rot-vermelho); }
.rot-aviso-faixa { margin: 2px 0 0; font-size: 0.8em; color: var(--rot-laranja); }

/* Resultados */
.rot-resultado { border-top: 1px solid var(--rot-grade); padding-top: 10px; }
.rot-saidas { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 20px; margin: 0; }
.rot-saida { margin: 0; }
.rot-saida dt { font-size: 0.85em; color: var(--rot-tinta2); }
.rot-saida dd { margin: 0; font-variant-numeric: tabular-nums; font-size: 1.05em; }
.rot-saida-texto { grid-column: 1 / -1; }
.rot-destaque { font-weight: 700; color: var(--rot-marca); font-size: 1.2em !important; }
.rot-destaque-linha { font-weight: 700; color: var(--rot-marca); }
.rot-nota { font-size: 0.88em; color: var(--rot-tinta2); margin: 4px 0; }
.rot-explicacao { background: var(--rot-fundo); border-left: 3px solid var(--rot-agua); padding: 8px 12px; }
.rot-explicacao p { margin: 0; }
.rot-erro { color: var(--rot-vermelho); font-weight: 600; }
.rot-marcador-vazio { color: var(--rot-laranja); font-family: monospace; font-size: 0.9em; }

/* Gabaritos */
.rot-gabarito { margin: 4px 0; font-size: 0.92em; padding: 4px 8px; border-radius: 4px; }
.rot-certo { background: #e5f6ef; color: #0d5c40; }
.rot-parcial { background: #fdf3d9; color: #6b4a00; }
.rot-errado { background: #fde8e7; color: #8a1f1e; }
.rot-sem_resposta, .rot-aberta { background: var(--rot-fundo); color: var(--rot-tinta2); }

/* Tabelas */
.rot-tabela { border-collapse: collapse; width: 100%; font-size: 0.92em; font-variant-numeric: tabular-nums; }
.rot-tabela th, .rot-tabela td { padding: 5px 8px; border-bottom: 1px solid var(--rot-grade); text-align: right; }
.rot-tabela th:first-child, .rot-tabela thead th { text-align: left; }
.rot-tabela thead th { color: var(--rot-tinta2); font-weight: 600; }
.rot-tabela tfoot td, .rot-tabela tfoot th { border-top: 2px solid var(--rot-marca); }
.rot-quadro { border: 1px dashed var(--rot-referencia); border-radius: 6px; padding: 10px 12px; overflow-x: auto; }

/* Régua do juro neutro (N09) */
.rot-regua { margin: 10px 0; }
.rot-regua-trilho { position: relative; height: 14px; border-radius: 7px; background: linear-gradient(90deg, var(--rot-agua), var(--rot-grade) 50%, var(--rot-laranja)); }
.rot-regua-faixa { position: absolute; top: 0; bottom: 0; background: rgba(255, 255, 255, 0.6); }
.rot-regua-marca { position: absolute; top: -4px; width: 4px; height: 22px; margin-left: -2px; background: var(--rot-marca); border-radius: 2px; }
.rot-regua-rotulos { display: flex; justify-content: space-between; font-size: 0.82em; color: var(--rot-tinta2); }

/* Gráfico SVG (N21) */
.rot-grafico { margin-top: 10px; }
.rot-svg { width: 100%; height: auto; max-height: 300px; }
.rot-svg-grade { stroke: var(--rot-grade); stroke-width: 1; }
.rot-svg-texto { fill: var(--rot-tinta2); font-size: 12px; }
.rot-svg-linha { fill: none; stroke: var(--rot-azul); stroke-width: 3; }
.rot-svg-ref { fill: none; stroke: var(--rot-referencia); stroke-width: 2; stroke-dasharray: 6 5; }
.rot-legenda { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.85em; color: var(--rot-tinta2); }
.rot-legenda-item { display: inline-flex; align-items: center; gap: 6px; }
.rot-legenda-traco { display: inline-block; width: 22px; border-top: 3px solid var(--rot-azul); }
.rot-legenda-traco.rot-tracejado { border-top: 2px dashed var(--rot-referencia); }
.rot-detalhes summary { cursor: pointer; color: var(--rot-marca); font-size: 0.9em; }

/* Passos da IS (M1) */
.rot-passos { padding-left: 1.4em; }
.rot-passos li { margin: 4px 0; }

/* Classificadores (N04, N13) */
.rot-itens { padding-left: 1.4em; }
.rot-itens li { margin: 8px 0; }
.rot-opcoes-grade { display: flex; flex-wrap: wrap; }
.rot-cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.rot-cartao { border: 1px solid var(--rot-grade); border-radius: 6px; padding: 8px 12px; background: var(--rot-fundo); }
.rot-cartao h4 { margin-top: 0; }
.rot-2x2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.rot-2x2-celula { border: 1px solid var(--rot-grade); border-radius: 6px; padding: 8px; min-height: 80px; }
.rot-2x2-titulo { margin: 0; font-weight: 600; font-size: 0.9em; }
.rot-2x2-sentido { margin: 0; font-size: 0.8em; color: var(--rot-suave); }
.rot-2x2-lista { margin: 4px 0 0; padding-left: 1.1em; font-size: 0.88em; }

/* Cartões de erros (N27) */
.rot-cartoes-erros { padding-left: 1.4em; }
.rot-cartao-erro { margin: 10px 0; }
.rot-frase { font-style: italic; margin: 0 0 4px; }
.rot-verso { border-left: 4px solid var(--rot-referencia); padding: 6px 10px; background: var(--rot-fundo); }
.rot-verso p { margin: 2px 0; }
.rot-selo-modelo { border-left-color: var(--rot-agua); }
.rot-selo-parte { border-left-color: var(--rot-amarelo); }
.rot-selo-fora { border-left-color: var(--rot-vermelho); }

/* Confira */
.rot-confira { padding-left: 1.4em; }
.rot-confira > li { margin: 10px 0; }
.rot-pergunta-confira { margin: 0 0 4px; }
.rot-resposta { background: var(--rot-fundo); border-left: 3px solid var(--rot-agua); padding: 6px 10px; margin-top: 6px; }
.rot-resposta p { margin: 0 0 6px; }
.rot-autoavaliacao { display: flex; flex-wrap: wrap; gap: 6px; }
.rot-visivel-leitor {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Antes × depois (F2) */
.rot-figura { margin: 8px 0 0; }
.rot-figura-area { min-height: 120px; }
.rot-img, .rot-plotly { width: 100%; height: auto; }
.rot-plotly { min-height: 320px; }
.rot-figura-vazia {
  border: 1px dashed var(--rot-referencia); border-radius: 6px; padding: 18px; text-align: center;
  color: var(--rot-tinta2); background: var(--rot-fundo);
}
.rot-link-botao { margin-top: 6px; }

/* Figura simples (F2), montada de <figure data-rot-figura> */
.rot-fig { margin: 18px 0; max-width: 100%; }
.rot-fig-titulo { font-weight: 600; margin: 0 0 6px; color: var(--marca, #0f3d5c); }
.rot-fig-com-titulo > .rot-fig-titulo {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.rot-fig-area { min-height: 120px; }
.rot-fig .rot-plotly { width: 100%; }
.rot-fig .rot-nota { font-size: 0.88em; color: var(--tinta2, #52514e); }
.rot-fig .rot-figura-vazia {
  border: 1px dashed var(--referencia, #a3a29c); border-radius: 6px; padding: 18px; text-align: center;
  color: var(--tinta2, #52514e); background: var(--fundo, #fcfcfb);
}
.rot-fig-desc { font-size: 0.88em; color: var(--tinta2, #52514e); margin-top: 4px; }
.rot-fig-desc summary { cursor: pointer; color: var(--marca, #0f3d5c); }
.rot-fig-desc p { margin: 4px 0 0; }
.rot-reserva[hidden] { display: none !important; }

@media (max-width: 540px) {
  .rot-widget { padding: 12px; }
  .rot-2x2 { grid-template-columns: 1fr; }
}

/* ---- Bloco 6C: progresso, faixa "Voltar à etapa" (X7) e modo "prever antes" (X5) ----------------
   Fora de .rot-widget: usa os tokens de www/estilo.css, com reserva. */

/* Progresso no sumário */
.rot-progresso { background: var(--papel, #fff); border: 1px solid var(--grade, #e9e8e4); border-radius: .45rem;
  padding: .5rem .6rem; margin: 0 0 .8rem; font-size: .88rem; }
.rot-progresso p { margin: 0; }
.rot-progresso-resumo { font-weight: 600; color: var(--tinta, #0b0b0b); }
.rot-progresso-trilho { height: 6px; border-radius: 999px; background: var(--grade, #e9e8e4); overflow: hidden; margin: .38rem 0 .25rem; }
.rot-progresso-enchimento { height: 100%; background: #11734f; border-radius: 999px; transition: width .25s ease; }
.rot-progresso-aviso { margin-top: .3rem !important; color: #8a4b00; }
.rot-progresso-aviso[hidden], .rot-apagar-confirma[hidden] { display: none !important; }
.rot-progresso-nota { color: var(--tinta2, #52514e); font-size: .82rem; margin-top: .2rem !important; }
.rot-apagar-botao { padding: .1rem 0; font-size: .85rem; color: var(--marca, #0f3d5c); }
.rot-apagar-botao:disabled { color: var(--tinta2, #52514e); text-decoration: none; opacity: .6; }
.rot-apagar-confirma { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .2rem 0 .3rem; }
.rot-apagar-pergunta { flex: 1 1 100%; font-size: .85rem; }
/* verde escuro (#11734f, 5,3:1): o --agua dava 2,5:1 no ✓ e no botão "Marcar etapa como feita" (R7) */
.rot-item-estado { flex: none; color: #11734f; font-weight: 700; }
.rot-item-etapa[aria-current="page"] .rot-item-estado { color: #fff; }
.rot-item-feita .rot-item-titulo { color: var(--tinta2, #52514e); }
.rot-item-etapa[aria-current="page"].rot-item-feita .rot-item-titulo { color: #fff; }

/* Fim da etapa: marcar como feita */
.rot-feita { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: 2rem 0 0;
  padding: .8rem 1rem; background: var(--creme, #f4f1ea); border-radius: .5rem; }
.rot-feita-estado { margin: 0; font-weight: 600; color: #11734f; }
.rot-feita-estado:empty { display: none; }
.rot-feita .rot-feita-botao { --bs-btn-color: #11734f; --bs-btn-border-color: #11734f; --bs-btn-hover-bg: #11734f;
  --bs-btn-hover-border-color: #11734f; --bs-btn-active-bg: #11734f; --bs-btn-active-border-color: #11734f; }
.rot-feita-sim { background: #eaf6f0; }
.rot-feita + .rot-etapa-nav { margin-top: 1rem; }

/* Pré-requisitos ainda não feitos (a etapa continua livre) */
.rot-prereqs-aviso { margin: .25rem 0 0; font-size: .88rem; color: #8a4b00; }
.rot-prereqs a.rot-prereq-pendente { text-decoration-style: dashed; }

/* Faixa "Voltar à etapa" (www/app.js, parte 10): presa no canto de baixo no computador; no
   celular, no fluxo, logo abaixo do menu (não cobre controles) */
.rot-volta { position: fixed; left: 1rem; bottom: 1rem; z-index: 1030; display: flex; align-items: stretch;
  max-width: min(34rem, calc(100vw - 2rem)); background: var(--marca, #0f3d5c); color: #fff;
  border-radius: .55rem; box-shadow: 0 6px 18px rgba(0, 0, 0, .22); font-size: .95rem; }
.rot-volta[hidden] { display: none !important; }
.rot-volta-link { flex: 1; min-width: 0; color: #fff; text-decoration: none; padding: .6rem .4rem .6rem .9rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.rot-volta-link:hover, .rot-volta-link:focus-visible { color: #fff; text-decoration: underline; }
.rot-volta-titulo { font-weight: 400; }
.rot-volta-fechar { flex: none; border: 0; background: transparent; color: #fff; font-size: 1.35rem; line-height: 1;
  padding: 0 .8rem; border-left: 1px solid rgba(255, 255, 255, .25); border-radius: 0 .55rem .55rem 0; cursor: pointer; }
.rot-volta-fechar:hover { background: rgba(255, 255, 255, .12); }
.rot-volta a:focus-visible, .rot-volta-fechar:focus-visible { outline: 3px solid var(--laranja, #eb6834); outline-offset: -3px; }
body.com-rot-volta { padding-bottom: 4.5rem; }
@media (max-width: 767.98px) {
  .rot-volta { position: static; max-width: none; margin: .5rem .5rem 0; box-shadow: none; }
  body.com-rot-volta { padding-bottom: 0; }
}

/* Voltar no tempo, modo "prever antes" (#tempo:<tri>&prever=1; www/app.js, parte 9).
   Sem a classe no body, o bloco da faixa fica escondido e nada do "depois" some. */
.faixa-prever { display: none; }
body.tempo-prever .faixa-prever { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .7rem;
  margin-top: .4rem; padding-top: .4rem; border-top: 1px dashed #e3b59e; }
.faixa-prever-texto { margin: 0; font-weight: 600; }
body.tempo-prever .cartao-depois,
body.tempo-prever .narrativa-depois-titulo,
body.tempo-prever .narrativa-depois-titulo ~ * { display: none !important; }
.faixa-tempo:focus { outline: none; }
