/* ==========================================================================
   GO86 — modal de ficha técnica + documento (.doc)
   O bloco .doc é reutilizado pela subpágina (topico.php).
   ========================================================================== */

/* ---------- utilidades ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- overlay ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.is-open { display: flex; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 7, 12, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: modalFade 0.35s var(--ease) both;
}

.modal__dialog {
  position: relative;
  width: min(880px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: #0C111B;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 18px;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  overflow: hidden;
  animation: modalRise 0.45s var(--ease) both;
}

@keyframes modalFade { from { opacity: 0; } to { opacity: 1; } }

@keyframes modalRise {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* ---------- barra ---------- */
.modal__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.018);
  flex-shrink: 0;
}

.modal__bar-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold, #D4AF37);
}

.modal__close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #97A1B2;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.modal__close:hover {
  color: #F3E5AB;
  border-color: rgba(212, 175, 55, 0.45);
  background: rgba(212, 175, 55, 0.08);
}

/* ---------- corpo ---------- */
.modal__scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(22px, 3.6vw, 36px);
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.35) transparent;
}

.modal__scroll::-webkit-scrollbar { width: 8px; }
.modal__scroll::-webkit-scrollbar-thumb {
  background: rgba(212, 175, 55, 0.3);
  border-radius: 4px;
}

/* ==========================================================================
   DOCUMENTO
   ========================================================================== */
.doc { color: #C3CAD6; }

.doc__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 14px;
  margin-bottom: 14px;
}

.doc__code {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  padding: 4px 9px;
  border-radius: 5px;
  color: #0B0F19;
  background: linear-gradient(135deg, #F3E5AB, #D4AF37);
}

.doc__code--blue {
  color: #0A1424;
  background: linear-gradient(135deg, #C7D8FF, #7EA8FF);
}

.doc__title {
  font-size: clamp(1.3rem, 3vw, 1.65rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #F1F4F9;
  margin: 0;
  line-height: 1.15;
}

.doc__role {
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6E7789;
}

.doc__summary {
  font-size: 0.98rem;
  line-height: 1.7;
  color: #DCE1EA;
  padding: 14px 16px;
  border-left: 2px solid rgba(212, 175, 55, 0.55);
  background: rgba(212, 175, 55, 0.045);
  border-radius: 0 8px 8px 0;
  margin-bottom: 26px;
}

.doc__sec { margin-bottom: 26px; }

.doc__sec h4 {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #D4AF37;
  margin: 0 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.doc__sec p {
  font-size: 0.9rem;
  line-height: 1.72;
  color: #A9B2C1;
  margin: 0;
}

.doc__sec p + p { margin-top: 10px; }

.doc__sec code,
.fn__desc code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.84em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(212, 175, 55, 0.1);
  color: #F3E5AB;
  white-space: nowrap;
}

.doc__sec strong { color: #E9ECF3; font-weight: 700; }

/* passos */
.doc__steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 9px;
}

.doc__steps li {
  position: relative;
  counter-increment: step;
  padding-left: 34px;
  font-size: 0.87rem;
  line-height: 1.68;
  color: #A9B2C1;
}

.doc__steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1em;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #D4AF37;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 4px;
  padding: 2px 5px;
  line-height: 1.3;
}

/* especificação */
.doc__specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  overflow: hidden;
}

.doc__specs > div {
  background: #0C111B;
  padding: 11px 14px;
}

.doc__specs dt {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #6E7789;
  margin-bottom: 4px;
}

.doc__specs dd {
  margin: 0;
  font-size: 0.83rem;
  font-weight: 600;
  color: #DCE1EA;
  line-height: 1.45;
}

/* funções */
.doc__funcs { display: grid; gap: 1px; background: rgba(255, 255, 255, 0.055); border-radius: 10px; overflow: hidden; }

.fn {
  background: #0C111B;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: baseline;
}

.fn .fn__sig {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
  color: #F3E5AB;
  word-break: break-word;
  /* anula o realce herdado de .doc__sec code */
  background: none;
  padding: 0;
  border-radius: 0;
  white-space: normal;
}

.fn__access {
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8FA6C9;
  border: 1px solid rgba(143, 166, 201, 0.28);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
}

.fn__desc {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.62;
  color: #8C95A6;
}

/* regras */
.doc__rules {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.doc__rules li {
  position: relative;
  padding-left: 16px;
  font-size: 0.87rem;
  line-height: 1.66;
  color: #A9B2C1;
}

.doc__rules li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 1px;
  background: #D4AF37;
}

/* correlações */
.doc__rel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.rel {
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.015);
  transition: border-color 0.3s ease, background 0.3s ease;
}

.rel:hover {
  border-color: rgba(212, 175, 55, 0.3);
  background: rgba(212, 175, 55, 0.04);
}

.rel__to {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #F3E5AB;
  margin-bottom: 6px;
}

.rel__to::before {
  content: "→ ";
  color: #D4AF37;
}

.rel p {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.62;
  color: #8C95A6;
}

.rel p code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  color: #C9D3E3;
  background: rgba(255, 255, 255, 0.05);
  padding: 1px 4px;
  border-radius: 3px;
}

/* rodapé do documento */
.doc__foot {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

/* ---------- trava de scroll no body ---------- */
body.modal-open { overflow: hidden; }

/* ---------- responsivo ---------- */
@media (max-width: 720px) {
  .modal { padding: 10px; }
  .modal__dialog { max-height: 92vh; }
  .doc__specs { grid-template-columns: 1fr; }
  .doc__rel { grid-template-columns: 1fr; }
  .fn { grid-template-columns: 1fr; }
  .fn__access { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .modal__backdrop,
  .modal__dialog { animation: none; }
}
