/* ============================================================
   Central de Ajuda — Senha Digital
   Tema próprio (docsify) · estética de impressão de segurança:
   papel + tinta-marinho, verde-selo, vermelho-lacre, guilhoché.
   ============================================================ */

:root {
  --paper: #f6f7f4;
  --surface: #ffffff;
  --ink: #1c2739;
  --ink-soft: #5b6880;
  --accent: #172362;
  --accent-ink: #172362;
  --accent-wash: rgba(23, 35, 98, 0.08);
  --lacre: #b3382e;
  --line: #e3e7e0;
  --line-strong: #cfd5cc;
  --code-bg: #eef1ec;
  --shadow: 0 1px 2px rgba(28, 39, 57, 0.06), 0 8px 24px -18px rgba(28, 39, 57, 0.25);
  --note: #3e6da8;
  --warn: #a66e00;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #0e141d;
  --surface: #141c28;
  --ink: #e6ebf1;
  --ink-soft: #93a0b4;
  --accent: #0f7bcd;
  --accent-ink: #4ba3e3;
  --accent-wash: rgba(15, 123, 205, 0.12);
  --lacre: #e06055;
  --line: #232f3e;
  --line-strong: #314053;
  --code-bg: #1a2432;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px -20px rgba(0, 0, 0, 0.8);
  --note: #7fa7dc;
  --warn: #d9a23b;
  color-scheme: dark;
}

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

* { box-sizing: border-box; }

html { font-size: 17px; }

html, body { height: 100%; margin: 0; }

body {
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

::selection { background: rgba(23, 35, 98, 0.16); }
[data-theme="dark"] ::selection { background: rgba(15, 123, 205, 0.3); }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid var(--paper); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- sidebar ---------- */

.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: 304px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 0 0 2.5rem;
  z-index: 20;
  transition: transform 0.25s ease, background 0.25s ease;
}

.sidebar > h1.app-name {
  margin: 0;
  padding: 1.35rem 1.25rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.app-name a {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--ink);
  text-decoration: none;
}

.app-name svg { width: 44px; height: 44px; color: var(--accent); flex: none; transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.app-name a:hover svg { transform: rotate(22.5deg); }

.app-name .brand { display: flex; flex-direction: column; line-height: 1.22; }
.app-name .brand b {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.app-name .brand i {
  font-style: normal;
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-ink);
  margin-top: 2px;
}

/* busca — gatilho na sidebar */
.search-trigger {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: calc(100% - 2.2rem);
  margin: 0.9rem 1.1rem;
  padding: 0.5rem 0.85rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.83rem;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-trigger:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search-trigger svg { width: 15px; height: 15px; flex: none; }
.search-trigger span:nth-child(2) { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-trigger .kbd-hint {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.08rem 0.35rem;
  background: var(--surface);
}

/* busca — paleta central */
.search-modal { position: fixed; inset: 0; z-index: 60; }
.search-modal[hidden] { display: none; }

.search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 29, 0.45);
  backdrop-filter: blur(2px);
}

.search-panel {
  position: relative;
  max-width: 640px;
  margin: 11vh auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 70px -24px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  max-height: 68vh;
  overflow: hidden;
  animation: rise 0.18s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.search-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.search-head svg { width: 18px; height: 18px; color: var(--accent-ink); flex: none; }
.search-head input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
}
.search-head input::placeholder { color: var(--ink-soft); }
.search-head input::-webkit-search-cancel-button { display: none; }

.search-modal kbd {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0.1rem 0.38rem;
  background: var(--paper);
}

.search-results { overflow-y: auto; padding: 0.55rem; flex: 1; }
.search-results:empty { padding: 0; }

.search-results .result {
  display: block;
  padding: 0.7rem 0.9rem;
  margin: 0.2rem 0;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid transparent;
}
.search-results .result:hover,
.search-results .result.active { background: var(--accent-wash); border-color: var(--line); }

.search-results .crumb {
  display: block;
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent-ink);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-results .snippet { display: block; font-size: 0.88rem; line-height: 1.6; color: var(--ink-soft); }
.search-results mark { background: transparent; color: var(--lacre); font-weight: 700; }
.search-results .no-results { font-size: 0.88rem; color: var(--ink-soft); padding: 1rem; margin: 0; text-align: center; }

.search-foot {
  display: flex;
  gap: 1.1rem;
  padding: 0.55rem 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.7rem;
  color: var(--ink-soft);
}
.search-foot span { display: flex; align-items: center; gap: 0.3rem; }

@media (max-width: 768px) {
  .search-panel { margin: 5vh 0.8rem 0; max-height: 80vh; }
}

/* navegação */
.sidebar-nav { padding: 0.7rem 0.9rem; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }
.sidebar-nav ul ul { margin-bottom: 0.35rem; }

.sidebar-nav li > p {
  margin: 1.25rem 0.35rem 0.35rem;
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.sidebar-nav li > p strong { font-weight: 600; }

.sidebar-nav a {
  display: block;
  padding: 0.32rem 0.7rem;
  margin: 1px 0;
  font-size: 0.86rem;
  color: var(--ink);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 7px 7px 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sidebar-nav a:hover { background: var(--accent-wash); color: var(--accent-ink); }
.sidebar-nav li.active > a {
  border-left-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---------- área de conteúdo ---------- */

main { display: block; }

.content {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 304px;
  padding-top: 0;
  transition: left 0.25s ease, transform 0.25s ease;
}

.markdown-section {
  max-width: 47.5rem;
  margin: 0 auto;
  padding: 3.4rem 2.4rem 6rem;
  animation: rise 0.4s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- tipografia ---------- */

.markdown-section h1,
.markdown-section h2,
.markdown-section h3 {
  font-family: "Bricolage Grotesque", sans-serif;
  color: var(--ink);
  line-height: 1.25;
  scroll-margin-top: 2rem;
}

.markdown-section h1 {
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.022em;
  margin: 0 0 0.6rem;
}

.markdown-section h2 {
  font-size: 1.42rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 2.7rem 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.markdown-section h3 { font-size: 1.1rem; font-weight: 600; margin: 2rem 0 0.6rem; }

.markdown-section p, .markdown-section li { font-size: 1rem; }
.markdown-section p { margin: 0.9rem 0; }

.markdown-section a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
.markdown-section a:hover { text-decoration-color: var(--accent); }

/* âncoras que o docsify injeta nos títulos não são "links" visualmente */
.markdown-section h1 a, .markdown-section h2 a, .markdown-section h3 a,
.markdown-section h4 a, .markdown-section h5 a {
  color: inherit;
  text-decoration: none;
}

.markdown-section strong { font-weight: 700; }

.markdown-section hr { border: 0; border-top: 1px solid var(--line); margin: 2.6rem 0; }

.markdown-section ul, .markdown-section ol { padding-left: 1.5rem; }
.markdown-section li { margin: 0.3rem 0; }
.markdown-section li::marker { color: var(--accent); }

/* ---------- imagens ---------- */

.markdown-section img {
  max-width: 100%;
  display: block;
  margin: 1.5rem auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: #fff;
}

/* imagens pequenas embutidas no texto (ícones) ficam inline */
.markdown-section p img[src*="problemas-no-scanner-01"],
.markdown-section a img {
  display: inline-block;
  vertical-align: middle;
  margin: 0 0.3rem;
  box-shadow: none;
}

.medium-zoom-overlay { background: var(--paper) !important; z-index: 40 !important; }
.medium-zoom-image--opened { z-index: 41 !important; }

/* ---------- tabelas ---------- */

.markdown-section table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0;
  display: table;
  font-size: 0.95rem;
}

.markdown-section thead th {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-soft);
  text-align: left;
  padding: 0.45rem 0.8rem;
  border-bottom: 2px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}

.markdown-section td {
  padding: 0.62rem 0.8rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.markdown-section tbody tr { transition: background 0.12s ease; }
.markdown-section tbody tr:hover { background: var(--accent-wash); }

/* ---------- citações e alertas ---------- */

.markdown-section blockquote {
  margin: 1.6rem 0;
  padding: 0.9rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  color: var(--ink);
}
.markdown-section blockquote p { margin: 0.3rem 0; }

.markdown-section .alert.callout {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 10px;
  padding: 0.95rem 1.25rem;
  margin: 1.7rem 0;
  background: var(--surface);
}

.markdown-section .alert.callout p.title {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin: 0 0 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* !important: o CSS embutido do plugin de alertas define as próprias cores de borda */
.markdown-section .alert.callout.note { border-left-color: var(--note) !important; }
.markdown-section .alert.callout.note p.title { color: var(--note); }
.markdown-section .alert.callout.tip { border-left-color: var(--accent) !important; }
.markdown-section .alert.callout.tip p.title { color: var(--accent-ink); }
.markdown-section .alert.callout.warning { border-left-color: var(--warn) !important; }
.markdown-section .alert.callout.warning p.title { color: var(--warn); }
.markdown-section .alert.callout.important { border-left-color: var(--lacre) !important; }
.markdown-section .alert.callout.important p.title { color: var(--lacre); }

/* o plugin insere um span de ícone que vira um vão em branco — o rótulo tipográfico basta */
.markdown-section .alert.callout p.title .icon { display: none; }

/* ---------- código ---------- */

.markdown-section code {
  font-family: "Spline Sans Mono", monospace;
  font-size: 0.84em;
  background: var(--code-bg);
  padding: 0.14em 0.42em;
  border-radius: 5px;
}

.markdown-section pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.2rem;
  overflow: auto;
  margin: 1.4rem 0;
}
.markdown-section pre > code { background: transparent; padding: 0; font-size: 0.86rem; line-height: 1.6; color: var(--ink); }

.token.comment { color: var(--ink-soft); }
.token.string, .token.attr-value { color: var(--accent-ink); }
.token.keyword, .token.tag { color: var(--lacre); }

/* ---------- mermaid: diagrama como documento impresso ---------- */

.markdown-section .mermaid {
  display: flex;
  justify-content: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.3rem 1rem;
  margin: 1.6rem 0;
  overflow-x: auto;
}

/* ---------- botões flutuantes ---------- */

#theme-btn {
  position: fixed;
  z-index: 30;
  top: 1.1rem;
  right: 1.2rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.25s ease;
  padding: 0;
}
#theme-btn:hover { transform: translateY(-1px); border-color: var(--accent); }
#theme-btn svg { width: 18px; height: 18px; }
#theme-btn .moon { display: none; }
[data-theme="dark"] #theme-btn .sun { display: none; }
[data-theme="dark"] #theme-btn .moon { display: block; }

/* aba de recolher acoplada à borda da sidebar — fica fora do texto do menu */
.sidebar-toggle {
  position: fixed;
  z-index: 25;
  top: 50%;
  left: 304px;
  transform: translateY(-50%);
  width: 16px;
  height: 48px;
  border: 1px solid transparent;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--line-strong);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: left 0.25s ease, color 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.sidebar-toggle:hover { color: var(--accent-ink); background: var(--surface); border-color: var(--line); }
body.close .sidebar-toggle { left: 0; }

.sidebar-toggle .sidebar-toggle-button { position: relative; width: 10px; height: 13px; transition: transform 0.25s ease; }
.sidebar-toggle span {
  position: absolute;
  left: 1px;
  display: block;
  width: 9px;
  height: 1.8px;
  background: currentColor;
  border-radius: 2px;
}
.sidebar-toggle span:nth-child(1) { top: 3px; transform: rotate(-40deg); }
.sidebar-toggle span:nth-child(2) { display: none; }
.sidebar-toggle span:nth-child(3) { top: 9px; transform: rotate(40deg); }
body.close .sidebar-toggle .sidebar-toggle-button { transform: rotate(180deg); }

/* ---------- recolher / mobile (convenção docsify) ---------- */

body.close .sidebar { transform: translateX(-304px); }
body.close .content { left: 0; }

@media (max-width: 768px) {
  html { font-size: 16px; }
  .sidebar { transform: translateX(-304px); box-shadow: none; }
  .content { left: 0; }
  .markdown-section { padding: 2.4rem 1.2rem 4rem; }
  body.close .sidebar { transform: translateX(0); box-shadow: 0 0 0 100vmax rgba(15, 20, 29, 0.35); }
  body.close .content { left: 0; transform: translateX(304px); }
  #theme-btn { top: 0.8rem; right: 0.8rem; }

  /* no mobile a lógica é invertida: fechado por padrão, body.close = aberto */
  .sidebar-toggle { left: 0; }
  body.close .sidebar-toggle { left: 304px; }
  .sidebar-toggle .sidebar-toggle-button { transform: rotate(180deg); }
  body.close .sidebar-toggle .sidebar-toggle-button { transform: none; }
}

/* ---------- acessibilidade ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.progress { background: var(--accent); height: 2px; }
