/* ==========================================================================
   Sétimo — folha de estilo única
   Tokens em :root, com variante escura via prefers-color-scheme e [data-tema]
   ========================================================================== */

:root {
  color-scheme: light;

  --fundo: #fbfaf7;
  --fundo-card: #ffffff;
  --fundo-suave: #f2efe9;
  --fundo-codigo: #f5f2ec;

  --texto: #1e1c19;
  --texto-suave: #57534e;
  --texto-ténue: #8b857e;

  --borda: #e5e0d8;
  --borda-forte: #cfc8bd;

  --marca: #1f6f5c;
  --marca-clara: #e3f0ec;
  --marca-forte: #175647;

  --acento: #b8531f;
  --acento-claro: #fbeee5;

  --espaco-cor: #4a5fb8;
  --espaco-claro: #e8eaf8;
  --materiais-cor: #1f6f5c;
  --materiais-claro: #e3f0ec;
  --energia-cor: #b8531f;
  --energia-claro: #fbeee5;

  --raio: 10px;
  --raio-g: 16px;
  --sombra: 0 1px 2px rgba(30, 28, 25, .04), 0 4px 16px rgba(30, 28, 25, .05);
  --sombra-alta: 0 2px 6px rgba(30, 28, 25, .06), 0 12px 32px rgba(30, 28, 25, .09);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;

  --largura: 74rem;
  --largura-texto: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-tema="claro"]) {
    color-scheme: dark;

    --fundo: #16181a;
    --fundo-card: #1e2124;
    --fundo-suave: #24282c;
    --fundo-codigo: #24282c;

    --texto: #ecebe8;
    --texto-suave: #b3b0aa;
    --texto-ténue: #83807b;

    --borda: #32373b;
    --borda-forte: #454b50;

    --marca: #63c4a9;
    --marca-clara: #1b2f2a;
    --marca-forte: #7fd4bb;

    --acento: #e59462;
    --acento-claro: #33241a;

    --espaco-cor: #8fa0ea;
    --espaco-claro: #1e2340;
    --materiais-cor: #63c4a9;
    --materiais-claro: #1b2f2a;
    --energia-cor: #e59462;
    --energia-claro: #33241a;

    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --sombra-alta: 0 2px 6px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .4);
  }
}

:root[data-tema="escuro"] {
  color-scheme: dark;

  --fundo: #16181a;
  --fundo-card: #1e2124;
  --fundo-suave: #24282c;
  --fundo-codigo: #24282c;

  --texto: #ecebe8;
  --texto-suave: #b3b0aa;
  --texto-ténue: #83807b;

  --borda: #32373b;
  --borda-forte: #454b50;

  --marca: #63c4a9;
  --marca-clara: #1b2f2a;
  --marca-forte: #7fd4bb;

  --acento: #e59462;
  --acento-claro: #33241a;

  --espaco-cor: #8fa0ea;
  --espaco-claro: #1e2340;
  --materiais-cor: #63c4a9;
  --materiais-claro: #1b2f2a;
  --energia-cor: #e59462;
  --energia-claro: #33241a;

  --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --sombra-alta: 0 2px 6px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .4);
}

/* --------------------------------------------------------------- base --- */

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

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  line-height: 1.2;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--marca); text-underline-offset: 3px; }
a:hover { color: var(--marca-forte); }

:focus-visible {
  outline: 2px solid var(--marca);
  outline-offset: 3px;
  border-radius: 4px;
}

.envolve {
  max-width: var(--largura);
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

/* --------------------------------------------------------- cabeçalho --- */

.topo {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--fundo) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--borda);
}

.topo-int {
  max-width: var(--largura);
  margin: 0 auto;
  padding: .75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.marca {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--texto);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: .5rem;
}

.marca span {
  font-family: var(--sans);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--texto-ténue);
}

.topo nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.botao-topo {
  font: inherit;
  font-size: .85rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: .35rem .8rem;
  color: var(--texto-suave);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}

.botao-topo:hover {
  background: var(--fundo-suave);
  color: var(--texto);
}

.botao-topo[aria-pressed="true"] {
  background: var(--marca-clara);
  border-color: color-mix(in srgb, var(--marca) 30%, transparent);
  color: var(--marca-forte);
  font-weight: 600;
}

/* ------------------------------------------------------------- herói --- */

.heroi {
  padding: 4.5rem 0 3rem;
  border-bottom: 1px solid var(--borda);
}

.heroi h1 {
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  margin-bottom: .6rem;
}

.heroi .lead {
  font-size: 1.15rem;
  color: var(--texto-suave);
  max-width: var(--largura-texto);
}

.etiqueta-ano {
  display: inline-block;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--marca);
  background: var(--marca-clara);
  padding: .3rem .7rem;
  border-radius: 999px;
  margin-bottom: 1.1rem;
}

/* ---------------------------------------------- cartões (disciplinas) --- */

.seccao { padding: 3rem 0; }

.seccao-cab {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.seccao-cab h2 { font-size: 1.65rem; }

.seccao-cab .sub {
  font-size: .9rem;
  color: var(--texto-ténue);
}

.grelha {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 1rem;
}

.cartao {
  display: block;
  background: var(--fundo-card);
  border: 1px solid var(--borda);
  border-radius: var(--raio-g);
  padding: 1.3rem;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--sombra);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  position: relative;
}

a.cartao:hover {
  transform: translateY(-3px);
  box-shadow: var(--sombra-alta);
  border-color: var(--borda-forte);
}

.cartao.inativo {
  opacity: .62;
  cursor: default;
  box-shadow: none;
}

.cartao .emoji { font-size: 1.7rem; line-height: 1; display: block; margin-bottom: .7rem; }
.cartao h3 { font-size: 1.15rem; margin-bottom: .35rem; }
.cartao p { font-size: .9rem; color: var(--texto-suave); margin: 0; }

.cartao .area {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--texto-ténue);
  font-weight: 600;
  margin-bottom: .5rem;
  display: block;
}

.selo {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: 999px;
}

.selo.pronto { background: var(--marca-clara); color: var(--marca-forte); }
.selo.por-fazer { background: var(--fundo-suave); color: var(--texto-ténue); }

/* ------------------------------------------------ página da disciplina --- */

.disc-heroi {
  padding: 3rem 0 2.2rem;
  border-bottom: 1px solid var(--borda);
}

.migalhas {
  font-size: .85rem;
  color: var(--texto-ténue);
  margin-bottom: 1rem;
}

.migalhas a { color: var(--texto-suave); }

.disc-heroi h1 {
  font-size: clamp(2.1rem, 5vw, 3rem);
  display: flex;
  align-items: center;
  gap: .7rem;
  margin-bottom: .8rem;
}

.disc-heroi .lead {
  max-width: var(--largura-texto);
  color: var(--texto-suave);
  font-size: 1.05rem;
}

.dominio-atalhos {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.atalho {
  font-size: .85rem;
  text-decoration: none;
  padding: .4rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--borda-forte);
  color: var(--texto-suave);
  background: var(--fundo-card);
  transition: background .15s, color .15s;
}

.atalho:hover { background: var(--fundo-suave); color: var(--texto); }

/* --- domínios --- */

.dominio { padding: 3rem 0 1rem; scroll-margin-top: 5rem; }

.dominio-cab {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding-bottom: .8rem;
  border-bottom: 2px solid var(--cor, var(--marca));
  margin-bottom: .5rem;
}

.dominio-cab .emoji { font-size: 1.8rem; }
.dominio-cab h2 { font-size: 1.9rem; color: var(--cor, var(--texto)); }
.dominio-cab .sumario {
  margin-left: auto;
  font-size: .9rem;
  color: var(--texto-ténue);
  text-align: right;
  max-width: 28rem;
}

/* --- subdomínio --- */

.subdominio {
  background: var(--fundo-card);
  border: 1px solid var(--borda);
  border-radius: var(--raio-g);
  padding: 1.75rem;
  margin-top: 1.5rem;
  box-shadow: var(--sombra);
  scroll-margin-top: 5rem;
}

.subdominio > h3 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--cor, var(--texto));
}

.para-ti {
  max-width: var(--largura-texto);
  font-size: 1.02rem;
}

.perguntas {
  margin: 1.25rem 0 0;
  padding: 1rem 1.2rem;
  background: var(--fundo-suave);
  border-radius: var(--raio);
  border-left: 3px solid var(--cor, var(--marca));
}

.perguntas .rotulo {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--texto-ténue);
  display: block;
  margin-bottom: .5rem;
}

.perguntas ul { margin: 0; padding-left: 1.1rem; }
.perguntas li { margin-bottom: .3rem; font-style: italic; color: var(--texto-suave); }
.perguntas li:last-child { margin-bottom: 0; }

/* --- camada oficial (details) --- */

details.oficial {
  margin-top: 1.5rem;
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  background: var(--fundo);
  overflow: hidden;
}

details.oficial > summary {
  cursor: pointer;
  padding: .8rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--texto-suave);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .55rem;
  user-select: none;
}

details.oficial > summary::-webkit-details-marker { display: none; }

details.oficial > summary::before {
  content: "▸";
  color: var(--texto-ténue);
  transition: transform .18s;
  display: inline-block;
}

details.oficial[open] > summary::before { transform: rotate(90deg); }
details.oficial > summary:hover { background: var(--fundo-suave); color: var(--texto); }

details.oficial .conteudo {
  padding: .25rem 1rem 1.1rem 2.1rem;
  border-top: 1px solid var(--borda);
}

details.oficial ol {
  margin: .9rem 0 0;
  padding-left: 1.2rem;
  font-size: .94rem;
  color: var(--texto-suave);
}

details.oficial li { margin-bottom: .6rem; }

.nota-fonte {
  font-size: .78rem;
  color: var(--texto-ténue);
  margin-top: .9rem;
  padding-top: .7rem;
  border-top: 1px dashed var(--borda);
}

/* --- atividades --- */

.atividades-cab {
  margin: 1.9rem 0 .9rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--texto-ténue);
  display: flex;
  align-items: center;
  gap: .7rem;
}

.atividades-cab::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--borda);
}

.atividade {
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  margin-bottom: .8rem;
  background: var(--fundo);
  overflow: hidden;
}

.atividade > summary {
  cursor: pointer;
  padding: .95rem 1.1rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  user-select: none;
}

.atividade > summary::-webkit-details-marker { display: none; }
.atividade > summary:hover { background: var(--fundo-suave); }

.atividade .titulo {
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 600;
  flex: 1;
  min-width: 12rem;
}

.pilula {
  font-size: .7rem;
  font-weight: 600;
  padding: .22rem .6rem;
  border-radius: 999px;
  background: var(--cor-clara, var(--fundo-suave));
  color: var(--cor, var(--texto-suave));
  white-space: nowrap;
}

.pilula.tempo {
  background: var(--fundo-suave);
  color: var(--texto-ténue);
}

.atividade .corpo {
  padding: .3rem 1.1rem 1.3rem;
  border-top: 1px solid var(--borda);
}

.atividade h5 {
  font-family: var(--sans);
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--texto-ténue);
  margin: 1.2rem 0 .5rem;
}

.atividade ul.material {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.atividade ul.material li {
  font-size: .85rem;
  background: var(--fundo-suave);
  border-radius: var(--raio);
  padding: .28rem .65rem;
  color: var(--texto-suave);
}

.atividade ol.passos {
  margin: 0;
  padding-left: 1.3rem;
  max-width: var(--largura-texto);
}

.atividade ol.passos li { margin-bottom: .55rem; }

.caixa {
  margin-top: 1.2rem;
  padding: .85rem 1rem;
  border-radius: var(--raio);
  font-size: .9rem;
  display: flex;
  gap: .7rem;
  align-items: flex-start;
}

.caixa .icone { flex-shrink: 0; font-size: 1rem; line-height: 1.5; }
.caixa strong { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .15rem; }

.caixa.ligacao { background: var(--marca-clara); color: var(--texto); }
.caixa.ligacao strong { color: var(--marca-forte); }

.caixa.cuidado { background: var(--acento-claro); color: var(--texto); }
.caixa.cuidado strong { color: var(--acento); }

.caixa.reflexao {
  background: var(--fundo-suave);
  color: var(--texto-suave);
  font-style: italic;
}
.caixa.reflexao strong { color: var(--texto-ténue); font-style: normal; }

/* --------------------------------------------------------- modo aluno --- */

/* Em modo aluno, esconde a camada oficial e as notas de currículo. */
body[data-modo="aluno"] details.oficial,
body[data-modo="aluno"] .caixa.ligacao,
body[data-modo="aluno"] .nota-matriz {
  display: none;
}

/* Em modo currículo, encolhe a camada narrativa e abre a oficial. */
body[data-modo="curriculo"] .para-ti { color: var(--texto-suave); font-size: .95rem; }
body[data-modo="curriculo"] .perguntas { display: none; }

/* ------------------------------------------------------------- rodapé --- */

.rodape {
  margin-top: 4rem;
  padding: 2.5rem 0 3.5rem;
  border-top: 1px solid var(--borda);
  font-size: .87rem;
  color: var(--texto-ténue);
}

.rodape p { max-width: var(--largura-texto); }
.rodape a { color: var(--texto-suave); }

/* ------------------------------------------------------------- estado --- */

.estado {
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--texto-ténue);
}

.estado.erro { color: var(--acento); }

.nota-matriz {
  font-size: .85rem;
  color: var(--texto-ténue);
  background: var(--fundo-suave);
  border-radius: var(--raio);
  padding: .9rem 1.1rem;
  margin-top: 1.5rem;
  max-width: var(--largura-texto);
}

/* ------------------------------------------------------------ impressão */

@media print {
  .topo, .dominio-atalhos, .rodape { display: none; }
  details.oficial, details.atividade { border: none; }
  details.oficial > summary::before, .atividade > summary { display: none; }
  .subdominio { box-shadow: none; break-inside: avoid; }
  body { font-size: 11pt; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .envolve { padding: 0 1.1rem; }
  .topo-int { padding: .6rem 1.1rem; }
  .dominio-cab { flex-wrap: wrap; }
  .dominio-cab .sumario { margin-left: 0; text-align: left; width: 100%; }
  .subdominio { padding: 1.2rem; }
}
