/* Pentestas help — dark theme matching app.pentestas.com */

:root {
  --bg: #0B1220;
  --bg-2: #0E1627;
  --panel: #111A2B;
  --panel-2: #152138;
  --border: #1C2A44;
  --border-2: #243554;
  --text: #E5E7EB;
  --text-muted: #94A3B8;
  --text-dim: #64748B;
  --accent: #3B82F6;
  --accent-2: #60A5FA;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --success: #22C55E;
  --warn: #EAB308;
  --danger: #DC2626;
  --severity-critical: #DC2626;
  --severity-high: #EA580C;
  --severity-medium: #EAB308;
  --severity-low: #0EA5E9;
  --severity-info: #64748B;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;

  --sidebar-w: 260px;
  --toc-w: 220px;
  --topbar-h: 56px;
  --content-max: 780px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* -------------------- Topbar -------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 20px; }
.brand-name { font-weight: 700; }
.brand-sep { color: var(--text-dim); margin: 0 4px; }
.brand-section { color: var(--text-muted); font-weight: 500; }

.menu-btn {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  flex-direction: column;
  gap: 3px;
}
.menu-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

.top-search {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
}
.search-trigger {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  font-size: 13px;
  font-family: inherit;
}
.search-trigger:hover { background: var(--panel-2); border-color: var(--border-2); }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger svg { color: var(--text-dim); }
.search-trigger kbd {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
}

.top-links { display: flex; align-items: center; gap: 14px; }
.app-link {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* -------------------- Layout -------------------- */

.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
  gap: 28px;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 24px 0;
  font-size: 13.5px;
}

.nav-section { margin-bottom: 20px; }
.nav-section-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  padding: 6px 10px;
}
.nav-list { list-style: none; padding: 0; margin: 4px 0 0; }
.nav-link {
  display: block;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
}
.nav-link:hover {
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}
.nav-link.active {
  color: var(--text);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 500;
}

.content {
  padding: 24px 10px 80px;
  min-width: 0; /* enable grid cell shrinking for long <pre> */
}
.breadcrumb {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 16px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb .crumb-sep { color: var(--text-dim); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb span:last-child { color: var(--text); }

.article { max-width: var(--content-max); }
.article h1 {
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
  margin: 4px 0 12px;
  letter-spacing: -0.01em;
}
.article h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 42px 0 10px;
  letter-spacing: -0.005em;
  border-top: 1px solid var(--border);
  padding-top: 24px;
  position: relative;
}
.article h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 30px 0 6px;
}
.article h4 {
  font-size: 15px;
  font-weight: 600;
  margin: 22px 0 4px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.article p { margin: 0 0 14px; color: var(--text); }
.article ul, .article ol { margin: 0 0 14px 22px; padding: 0; }
.article li { margin-bottom: 6px; }
.article li > p { margin-bottom: 6px; }
.article strong { color: #fff; font-weight: 600; }
.article blockquote {
  border-left: 3px solid var(--accent);
  margin: 16px 0;
  padding: 6px 16px;
  color: var(--text-muted);
  background: var(--panel);
  border-radius: 0 6px 6px 0;
}
.article code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
}
.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}
.article th, .article td {
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}
.article th {
  background: var(--panel);
  color: var(--text);
  font-weight: 600;
}
.article hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.article kbd {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border-2);
  color: var(--text);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
}
.heading-anchor {
  color: var(--text-dim);
  text-decoration: none;
  margin-right: 6px;
  opacity: 0;
  font-weight: 500;
}
.article h2:hover .heading-anchor,
.article h3:hover .heading-anchor,
.article h4:hover .heading-anchor {
  opacity: 1;
}

/* Code blocks */
.article .code {
  margin: 16px 0;
  background: #070D1A;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 5px 12px;
  font-size: 11px;
  color: var(--text-muted);
}
.code-head .lang {
  font-family: var(--font-mono);
  text-transform: lowercase;
}
.code-head .copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  transition: color 120ms, border-color 120ms;
}
.code-head .copy:hover { color: var(--text); border-color: var(--border-2); }
.code-head .copy.ok { color: var(--success); border-color: var(--success); }
.article .code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
}
.article .code code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.55;
  color: #E2E8F0;
  white-space: pre;
}

/* Inline note boxes (markdown blockquote + bold keyword) */
.article .note,
.article .warn,
.article .tip {
  border-radius: 8px;
  padding: 14px 16px;
  margin: 16px 0;
  border: 1px solid var(--border);
  background: var(--panel);
}
.article .warn { border-color: rgba(234, 88, 12, 0.5); background: rgba(234, 88, 12, 0.08); }
.article .tip { border-color: rgba(34, 197, 94, 0.4); background: rgba(34, 197, 94, 0.08); }

/* On-this-page TOC (right rail) */
.toc {
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  padding: 28px 0;
  font-size: 12.5px;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}
.toc-heading {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  padding: 6px 8px;
  margin-bottom: 4px;
}
.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-list li { margin: 0; padding: 0; }
.toc-list a {
  display: block;
  padding: 4px 10px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  line-height: 1.45;
}
.toc-list a:hover { color: var(--text); text-decoration: none; }
.toc-list a.active { color: var(--text); border-left-color: var(--accent); background: var(--panel); }
.toc-list .toc-h3 a { padding-left: 24px; font-size: 12px; }

.article-footer {
  max-width: var(--content-max);
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 13px;
}

/* -------------------- Search modal -------------------- */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.search-modal[hidden] { display: none; }
.search-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.search-modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: min(640px, calc(100vw - 32px));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.search-modal-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}
.search-modal-input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 15px;
  outline: none;
  font-family: inherit;
}
.search-modal-input::placeholder { color: var(--text-dim); }
.search-modal-input-row .esc {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 60vh;
  overflow-y: auto;
}
.search-results li {
  padding: 0;
  margin: 0;
}
.search-results a {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.search-results a .r-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 3px;
}
.search-results a .r-title { font-weight: 500; }
.search-results a .r-snippet {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-results a mark {
  background: rgba(59, 130, 246, 0.3);
  color: var(--text);
  padding: 0 2px;
  border-radius: 2px;
}
.search-results a:hover,
.search-results a.active {
  background: var(--panel-2);
  border-left-color: var(--accent);
}
.search-hint {
  display: flex;
  gap: 18px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}
.search-hint kbd {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  margin-right: 3px;
}
.search-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* -------------------- Landing cards -------------------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 18px 0 24px;
}
.card-grid a {
  display: block;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  transition: transform 160ms, border-color 160ms, background 160ms;
}
.card-grid a:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--panel-2);
  text-decoration: none;
}
.card-grid .card-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.card-grid .card-summary {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}
.card-grid .card-icon {
  font-size: 18px;
}

/* -------------------- Responsive -------------------- */

@media (max-width: 1100px) {
  .toc { display: none; }
  .layout { grid-template-columns: var(--sidebar-w) 1fr; }
}
@media (max-width: 780px) {
  :root { --sidebar-w: 100%; }
  .menu-btn { display: flex; }
  .top-search .search-trigger { min-width: 0; padding: 7px 9px; }
  .top-search .search-trigger span { display: none; }
  .top-links { display: none; }
  .layout {
    grid-template-columns: 1fr;
    padding: 0 16px;
  }
  .sidebar {
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: var(--bg-2);
    z-index: 40;
    padding: 20px 20px 40px;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    height: calc(100vh - var(--topbar-h));
  }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 20px 0 60px; }
}
