/* Booknando Cursos — componentes do texto das aulas.
 *
 * O conteúdo declara estes componentes por classe (ver COMPONENTES em
 * app/services/htmlclean.py) e o leitura.js dá vida aos interativos. Tudo aqui usa
 * só os tokens de tokens.css, para que material de qualquer origem saia com a
 * identidade da Booknando.
 */

/* ---------- termos do glossário ---------- */
.reader__col a.termo {
  color: inherit; text-decoration: underline dotted var(--wine) 1.5px;
  text-underline-offset: 4px; cursor: pointer;
}
.reader__col a.termo:hover { color: var(--wine); }
.reader__col a.termo[aria-expanded="true"] { background: var(--wine-soft); color: var(--wine); border-radius: 3px; }
.reader__col a.termo:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; border-radius: 3px; }

.termo-pop {
  /* Acima do botão e do painel do tutor (61 e 60), abaixo do fundo de modal (80). */
  position: absolute; z-index: 70; width: min(340px, calc(100vw - 24px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: 0 10px 30px rgba(43, 10, 10, .14); padding: 18px 20px 16px;
}
.termo-pop__t { font-family: var(--font-head); font-weight: 700; font-size: 16.5px; padding-right: 26px; margin-bottom: 6px; }
.termo-pop__d { font-size: 14.5px; line-height: 1.6; color: var(--ink); margin-bottom: 10px; }
.termo-pop__a { font-size: 13.5px; font-weight: 700; color: var(--wine); }
.termo-pop__x {
  position: absolute; top: 10px; right: 10px; width: 28px; height: 28px;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.termo-pop__x:hover { background: var(--wine-soft); color: var(--wine); }
@media (max-width: 640px) {
  .termo-pop { position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; width: auto; }
}

/* ---------- caixas: uma cor por função ---------- */
.callout--pratica { border-left-color: var(--warn); background: var(--warn-bg); }
.callout--pratica .callout__label { color: var(--warn); }
.callout--atencao { border-left-color: var(--err); background: var(--err-bg); }
.callout--atencao .callout__label { color: var(--err); }
.callout--tarefa { border-left-color: var(--teal); background: rgba(63, 125, 140, .1); }
.callout--tarefa .callout__label { color: var(--teal); }
.callout--edital { border-left-color: var(--info); background: var(--info-bg); }
.callout--edital .callout__label { color: var(--muted); }
.callout--exemplo { border-left-color: var(--line); background: var(--surface-2); }
.callout--exemplo .callout__label { color: var(--muted); }
.callout pre:last-child, .callout ol:last-child, .callout ul:last-child { margin-bottom: 0; }

.reader__col blockquote {
  border-left: 3px solid var(--line); padding: 2px 0 2px 16px; margin: 0 0 16px;
  font-family: var(--font-head); font-size: 17px; color: var(--ink);
}
.reader__col blockquote p { font-size: inherit; margin-bottom: 0; }

/* ---------- cartões ---------- */
.cartoes {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px; margin: 0 0 20px;
}
.cartao {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 16px 18px;
}
.reader__col .cartao h4 { margin: 0 0 6px; font-size: 16px; }
.reader__col .cartao p { font-size: 15px; line-height: 1.6; margin-bottom: 8px; }
.reader__col .cartao p:last-child, .reader__col .cartao pre:last-child { margin-bottom: 0; }
.reader__col .cartao pre { font-size: 12.5px; }
figure .cartoes { margin-bottom: 0; }

/* ---------- linha do tempo ---------- */
.reader__col ol.linha-tempo { list-style: none; padding: 0; margin-left: 6px; border-left: 2px solid var(--wine-soft); }
.reader__col .linha-tempo li { position: relative; padding: 0 0 6px 22px; }
.reader__col .linha-tempo li::before {
  content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--wine); box-shadow: 0 0 0 3px var(--surface);
}
.reader__col .linha-tempo strong:first-child {
  display: block; font-family: var(--font-head); color: var(--wine); font-size: 17px;
}

/* ---------- fluxo de etapas ---------- */
.reader__col ol.fluxo {
  list-style: none; padding: 0; counter-reset: etapa;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px;
}
.reader__col .fluxo li {
  counter-increment: etapa; margin: 0; font-size: 14.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 7px 14px;
}
.reader__col .fluxo li::before { content: counter(etapa) " · "; color: var(--wine); }
.reader__col .fluxo li:not(:last-child)::after { content: "→"; color: var(--muted); margin-left: 12px; }

/* ---------- camadas (caixas concêntricas) ---------- */
.reader__col ul.camadas, .reader__col .camadas ul {
  list-style: none; margin: 0; padding: 12px 14px 14px; border-radius: var(--r-card);
}
.reader__col ul.camadas { background: var(--surface-2); border: 1px solid var(--line); }
.reader__col .camadas ul { margin-top: 10px; background: var(--wine-soft); }
.reader__col .camadas ul ul { background: #e8cfcb; }
.reader__col .camadas ul ul ul { background: var(--wine); color: #fff; }
.reader__col .camadas li { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .02em; }

/* ---------- tokens ---------- */
.reader__col p.tokens { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.reader__col .tokens code {
  font-size: 15px; padding: 6px 12px; border: 1.5px dashed var(--wine); background: var(--surface);
}

/* ---------- dicionário ---------- */
.reader__col dl { margin: 0 0 18px; }
.reader__col dt { font-weight: 700; font-size: 16px; margin-top: 14px; scroll-margin-top: 100px; }
.reader__col dd { margin: 4px 0 0; font-size: 15.5px; line-height: 1.65; color: var(--ink); }
.reader__col dt:target, .reader__col dt:target + dd { background: var(--wine-soft); }
.reader__col dt:target { color: var(--wine); padding: 6px 10px 0; border-radius: var(--r-input) var(--r-input) 0 0; }
.reader__col dt:target + dd { padding: 4px 10px 8px; border-radius: 0 0 var(--r-input) var(--r-input); }
.reader__col dl + h4, .reader__col .widget + h4 {
  border-bottom: 1px solid var(--line-2); padding-bottom: 4px; color: var(--wine);
}

/* ---------- recursos interativos ---------- */
.widget {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 20px 22px; margin: 0 0 22px;
}
.reader__col .widget p { font-size: 15.5px; }
.reader__col .w-frase { font-family: var(--font-head); font-size: 18px; font-weight: 600; margin-bottom: 14px; }
.reader__col .w-titulo { font-family: var(--font-head); font-weight: 700; font-size: 16.5px; margin-bottom: 4px; }
.reader__col .w-titulo--menor { font-size: 14.5px; display: block; margin: 14px 0 6px; }
.reader__col .w-nota { font-size: 13.5px; color: var(--muted); line-height: 1.6; margin: 10px 0 0; }
.reader__col .w-resultado { margin: 14px 0 0; }
.reader__col .w-resultado--grande { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--wine); }
.w-controles { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.w-controles label { font-size: 14.5px; font-weight: 600; }
.w-controles input[type="range"] { flex: 1 1 140px; accent-color: var(--wine); }
.w-aviso { font-size: 13.5px; color: var(--ok); }

.w-barras { display: grid; gap: 8px; }
.w-barra { display: grid; grid-template-columns: 84px 1fr 52px; align-items: center; gap: 10px; font-size: 14.5px; }
.w-barra__trilho { height: 10px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.w-barra__enche { display: block; height: 100%; background: var(--wine); border-radius: 6px; transition: width .25s ease; }
.w-barra__pct { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.w-barra--escolhida .w-barra__nome { font-weight: 700; color: var(--wine); }
.w-barra--escolhida .w-barra__enche { background: var(--logo-red); }

.w-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.w-chip {
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 8px 14px;
}
.w-chip:hover { border-color: var(--wine); color: var(--wine); }
.w-chip[aria-pressed="true"] { background: var(--wine); border-color: var(--wine); color: #fff; }

.w-campos { display: grid; gap: 12px; margin-top: 12px; }
.w-campo label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.w-campo textarea, .w-campo input, .widget input[type="search"] {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-input);
  padding: 10px 12px; resize: vertical;
}
.w-campo textarea:focus, .w-campo input:focus, .widget input[type="search"]:focus {
  outline: 2px solid var(--wine); outline-offset: 1px; border-color: var(--wine);
}
.reader__col .w-saida { white-space: pre-wrap; margin-bottom: 0; }

.w-mapa {
  position: relative; height: 260px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-input);
}
.w-mapa__pt {
  position: absolute; transform: translate(-50%, -50%); white-space: nowrap;
  font-size: 13px; font-weight: 600; background: var(--wine-soft); color: var(--wine);
  border-radius: var(--r-pill); padding: 4px 10px;
}

@media (max-width: 640px) {
  .widget { padding: 16px; }
  .w-barra { grid-template-columns: 70px 1fr 46px; }
  .reader__col ol.fluxo { flex-direction: column; align-items: flex-start; }
  .reader__col .fluxo li:not(:last-child)::after { content: "↓"; }
  .w-mapa__pt { font-size: 11.5px; padding: 3px 8px; }
}
