/* ==========================================================================
   SPTECH — Documentos institucionais (PDI, Regimento, PPCs, CPA, regulamentos)
   Depende de styles.css e course.css (hero, breadcrumb).
   ========================================================================== */

.doc-hero { padding-bottom: clamp(20px, 3vw, 32px); }
.doc-hero .c-hero__grid { grid-template-columns: 1fr; max-width: 900px; }
.doc-hero h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
.doc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.doc-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.doc-side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 22px; max-height: calc(100vh - var(--header-h) - 48px); overflow: auto; padding-right: 4px; scrollbar-width: thin; }
.doc-side h2 { margin-bottom: 8px; color: var(--muted); font-family: var(--font-display); font-size: 0.76rem; letter-spacing: 0.06em; text-transform: uppercase; }
.doc-toc ol, .doc-nav ul { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.doc-toc a, .doc-nav a {
  display: block;
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  transition: background 0.2s, color 0.2s;
}
.doc-toc a:hover, .doc-nav a:hover { background: var(--bg-soft); color: var(--ink); }
.doc-toc a.is-active { background: var(--ink); color: #fff; }
.doc-nav a[aria-current="page"] { color: var(--pink); box-shadow: inset 3px 0 0 var(--pink); border-radius: 0 10px 10px 0; }
.doc-toc-toggle { display: none; }

.doc-body { min-width: 0; max-width: 780px; font-size: 1.04rem; line-height: 1.75; color: #3d4659; }
.doc-body > * + * { margin-top: 1em; }
.doc-body h2 {
  margin-top: 2.2em;
  padding-top: 0.4em;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
  scroll-margin-top: calc(var(--header-h) + 24px);
}
.doc-body h2:first-child { margin-top: 0; }
.doc-body h3 { margin-top: 1.4em; color: var(--pink); font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; }
.doc-body h4 { margin-top: 1.4em; color: var(--ink); font-family: var(--font-display); font-size: 1rem; }
.doc-body strong { color: var(--ink); }
.doc-body a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--pink); text-underline-offset: 3px; }
.doc-body ul, .doc-body ol { display: grid; gap: 6px; padding-left: 1.3em; }
.doc-body .doc-lead { padding: 18px 22px; border-radius: var(--radius); background: var(--bg-soft); color: var(--ink); font-size: 1.08rem; }
.doc-body .doc-note { padding: 12px 18px; border-left: 4px solid var(--teal); background: color-mix(in srgb, var(--teal) 8%, #fff); color: var(--ink); font-weight: 600; }
.doc-figure { margin: 1.4em 0; }
.doc-figure img { width: auto; max-width: 100%; height: auto; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); }
.img-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px !important; padding: 0 !important; list-style: none; }
.img-grid li { display: grid; place-items: center; padding: 8px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.img-grid img { max-height: 80px; width: auto; object-fit: contain; }

.table-wrap { overflow-x: auto; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.doc-body table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 0.92rem; line-height: 1.45; }
.doc-body th, .doc-body td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.doc-body thead th { background: var(--bg-soft); color: var(--ink); font-family: var(--font-display); font-size: 0.82rem; }
.doc-body tr:last-child td { border-bottom: 0; }

/* Gráficos (boletins da CPA) */
.dchart { margin: 1.2em 0; padding: 20px; border-radius: var(--radius); background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.bars { display: grid !important; gap: 10px !important; padding: 0 !important; list-style: none; }
.bars li { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; gap: 12px; align-items: center; font-size: 0.92rem; }
.bar-label { color: var(--ink); font-weight: 600; line-height: 1.3; }
.bar { position: relative; display: flex; height: 14px; border-radius: 99px; background: var(--bg-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--pink); }
.bars li b { min-width: 52px; color: var(--ink); font-family: var(--font-display); text-align: right; }
.bars--stack .bar i { border-radius: 0; }
.bars--stack li { grid-template-columns: minmax(80px, 20%) 1fr; }
.bars--group li { grid-template-columns: minmax(120px, 34%) 1fr; }
.bars--group .group { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.bars--group .group b { font-size: 0.8rem; font-family: var(--font-body); color: var(--muted); text-align: left; }
.legend-list { display: grid !important; gap: 6px !important; padding: 0 !important; list-style: none; font-size: 0.9rem; }
.legend-list--row { display: flex !important; flex-wrap: wrap; gap: 6px 16px !important; margin-bottom: 14px; }
.legend-list i { display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 3px; vertical-align: -1px; }
.legend-list b { color: var(--ink); }
.dchart--pie { display: grid; grid-template-columns: 160px 1fr; gap: 20px; align-items: center; }
.pie { width: 160px; aspect-ratio: 1; border-radius: 50%; -webkit-mask: radial-gradient(circle, transparent 38%, #000 39%); mask: radial-gradient(circle, transparent 38%, #000 39%); }
.dchart--gauge { display: grid; place-items: center; }
.gauge {
  display: grid;
  place-items: center;
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--teal) calc(var(--v) * 1%), var(--bg-soft) 0);
}
.gauge span { display: grid; place-items: center; width: 74%; aspect-ratio: 1; border-radius: 50%; background: #fff; color: var(--ink); font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; }
.word-cloud { display: flex !important; flex-wrap: wrap; gap: 8px !important; padding: 0 !important; list-style: none; }
.word-cloud li { padding: 6px 12px; border-radius: 999px; background: var(--bg-soft); color: var(--ink); font-weight: 600; }
.word-cloud li:nth-child(3n + 1) { background: color-mix(in srgb, var(--pink) 12%, #fff); }
.word-cloud li:nth-child(4n + 2) { background: color-mix(in srgb, var(--teal) 14%, #fff); }
@media (max-width: 560px) {
  .bars li { grid-template-columns: 1fr auto; }
  .bars li .bar-label { grid-column: 1 / -1; }
  .bars--stack li, .bars--group li { grid-template-columns: 1fr; }
  .dchart--pie { grid-template-columns: 1fr; justify-items: center; }
}

/* Incorporação (Diploma Digital) */
.doc-embed { overflow: hidden; border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm); }
.doc-embed iframe { display: block; width: 100%; height: min(80vh, 900px); border: 0; }

/* Hub da CPA */
.cycles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 1.6em !important; }
.cycle {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-sm);
  text-decoration: none !important;
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.cycle:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }
.cycle img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.cycle span { display: block; padding: 16px 18px; color: var(--ink); font-family: var(--font-display); font-weight: 800; line-height: 1.25; }
.cycle small { display: block; margin-top: 4px; color: var(--muted); font-family: var(--font-body); font-weight: 600; }
@media (max-width: 760px) { .cycles { grid-template-columns: 1fr; } }

@media (max-width: 960px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-side { position: static; max-height: none; overflow: visible; }
  .doc-toc { padding: 4px; border-radius: var(--radius); background: var(--bg-soft); }
  .doc-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 14px;
    border: 0;
    border-radius: 12px;
    background: none;
    color: var(--ink);
    font-family: var(--font-display);
    font-weight: 700;
  }
  .doc-toc-toggle svg { width: 18px; height: 18px; transition: transform 0.25s; }
  .doc-toc[data-open="true"] .doc-toc-toggle svg { transform: rotate(180deg); }
  .doc-toc:not([data-open="true"]) ol, .doc-toc:not([data-open="true"]) h2 { display: none; }
  .doc-toc ol { max-height: 50vh; overflow: auto; padding: 0 6px 8px; }
  .doc-nav { display: none; }
}

@media print {
  .site-header, .site-footer, .fab-stack, .a11y-panel, .doc-side, .doc-actions, .breadcrumb, .cta { display: none !important; }
  .doc-layout { display: block; }
  .doc-body { max-width: none; }
}
