/* Design system adapted from devopsabcs-engineering/gh-advsec-devsecops (GitHub dark theme). */
:root {
  --gh-blue: #0969da;
  --gh-dark: #0d1117;
  --gh-gray-dark: #1c2128;
  --gh-gray: #30363d;
  --gh-gray-light: #484f58;
  --gh-border: #30363d;
  --gh-text: #e6edf3;
  --gh-text-muted: #8b949e;
  --gh-green: #3fb950;
  --gh-purple: #a371f7;
  --gh-orange: #d29922;
  --gh-red: #f85149;
  --gh-cyan: #58a6ff;
  --accent-gradient: linear-gradient(135deg, #58a6ff, #a371f7);
  --card-bg: #161b22;
  --card-border: #21262d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  background-color: var(--gh-dark);
  color: var(--gh-text);
  line-height: 1.7;
  font-size: 16px;
}

/* ── Hero ───────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 40%, #1a1e2e 70%, #0d1117 100%);
  border-bottom: 1px solid var(--card-border);
  padding: 80px 20px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(88,166,255,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 50%, rgba(163,113,247,0.06) 0%, transparent 50%);
  pointer-events: none;
}
.hero-badge {
  display: inline-block;
  background: rgba(88,166,255,0.1);
  border: 1px solid rgba(88,166,255,0.25);
  color: var(--gh-cyan);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 24px;
  position: relative;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  position: relative;
}
.hero .subtitle {
  font-size: 1.15rem;
  color: var(--gh-text-muted);
  max-width: 750px;
  margin: 0 auto 32px;
  position: relative;
}
.hero-meta {
  font-size: 0.85rem;
  color: var(--gh-text-muted);
  position: relative;
}
.hero-meta span { margin: 0 12px; }

/* ── Navigation ─────────────────────────────────────── */
.toc {
  background: var(--card-bg);
  border-bottom: 1px solid var(--card-border);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow-x: auto;
  white-space: nowrap;
}
.toc-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  gap: 0;
}
.toc a {
  display: inline-block;
  padding: 14px 18px;
  color: var(--gh-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}
.toc a:hover {
  color: var(--gh-text);
  border-bottom-color: var(--gh-cyan);
  background: rgba(88,166,255,0.05);
}

/* ── Layout ─────────────────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

section {
  padding: 64px 0;
  border-bottom: 1px solid var(--card-border);
}
section:last-of-type { border-bottom: none; }

h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--gh-text);
}
h2 .section-num {
  color: var(--gh-cyan);
  font-weight: 800;
  margin-right: 8px;
}
.section-lead {
  font-size: 1.05rem;
  color: var(--gh-text-muted);
  margin-bottom: 40px;
  max-width: 800px;
}

h3 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 40px 0 16px;
  color: var(--gh-text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--card-border);
}

h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--gh-text);
}

p { margin-bottom: 16px; }
strong { color: #f0f6fc; }
a { color: var(--gh-cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Blockquote ─────────────────────────────────────── */
blockquote {
  background: rgba(88,166,255,0.05);
  border-left: 4px solid var(--gh-cyan);
  padding: 20px 24px;
  margin: 24px 0;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--gh-text-muted);
}
blockquote strong { color: var(--gh-text); font-style: normal; }

/* ── Cards ──────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  transition: border-color 0.2s, transform 0.2s;
}
.card:hover {
  border-color: var(--gh-cyan);
  transform: translateY(-2px);
}
.card-icon { font-size: 1.6rem; margin-bottom: 12px; display: block; }
.card h4 { font-size: 1.05rem; font-weight: 600; margin-bottom: 8px; color: var(--gh-text); border: none; }
.card p { font-size: 0.9rem; color: var(--gh-text-muted); margin-bottom: 0; }

/* ── Tables ─────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead { background: rgba(88,166,255,0.08); }
th {
  text-align: left;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--gh-text);
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  color: var(--gh-text-muted);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(88,166,255,0.03); }
td strong { color: var(--gh-text); }

/* ── Stats Row ──────────────────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 32px 0;
}
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--gh-text-muted);
  margin-top: 4px;
}

/* ── Lists ──────────────────────────────────────────── */
ul, ol { margin: 16px 0 16px 24px; }
li { margin-bottom: 8px; color: var(--gh-text-muted); }
li strong { color: var(--gh-text); }

/* ── Mermaid ────────────────────────────────────────── */
.mermaid-wrapper {
  margin: 32px 0;
  padding: 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow-x: auto;
}
.mermaid {
  display: flex;
  justify-content: center;
}

/* ── Code / Pre ─────────────────────────────────────── */
pre {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 20px;
  margin: 16px 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--gh-text-muted);
  line-height: 1.6;
}
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: rgba(88,166,255,0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--gh-cyan);
}
pre code { background: none; padding: 0; color: inherit; }

/* ── Phases ─────────────────────────────────────────── */
.phase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.phase-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.phase-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.phase-card.p1::before { background: var(--gh-cyan); }
.phase-card.p2::before { background: var(--gh-green); }
.phase-card.p3::before { background: var(--gh-purple); }
.phase-card.p4::before { background: var(--gh-orange); }
.phase-num {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.p1 .phase-num { color: var(--gh-cyan); }
.p2 .phase-num { color: var(--gh-green); }
.p3 .phase-num { color: var(--gh-purple); }
.p4 .phase-num { color: var(--gh-orange); }
.phase-card h4 { font-size: 1.05rem; margin-bottom: 12px; border: none; }
.phase-card ul { margin-left: 16px; }
.phase-card li { font-size: 0.88rem; margin-bottom: 6px; }

/* ── CTA ────────────────────────────────────────────── */
.cta-box {
  background: linear-gradient(135deg, rgba(88,166,255,0.1), rgba(163,113,247,0.1));
  border: 1px solid rgba(88,166,255,0.25);
  border-radius: 16px;
  padding: 40px;
  margin: 40px 0;
  text-align: center;
}
.cta-box h3 {
  border-bottom: none;
  color: var(--gh-text);
  font-size: 1.5rem;
  margin: 0 0 16px;
}
.cta-box p {
  color: var(--gh-text-muted);
  font-size: 1.05rem;
  max-width: 700px;
  margin: 0 auto;
}

/* ── Workflow steps ──────────────────────────────────── */
.workflow {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 24px 24px 24px 48px;
  margin: 24px 0;
  position: relative;
}
.workflow-step {
  position: relative;
  padding: 8px 0 8px 0;
  color: var(--gh-text-muted);
  font-size: 0.95rem;
}
.workflow-step strong { color: var(--gh-text); }
.workflow-step .arrow { color: var(--gh-cyan); font-weight: 600; display: block; padding: 4px 0; font-size: 0.8rem; }

/* ── Footer ─────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 40px 20px;
  color: var(--gh-text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--card-border);
}
.footer a { color: var(--gh-cyan); }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
  .hero { padding: 48px 16px 40px; }
  .hero h1 { font-size: 1.8rem; }
  section { padding: 40px 0; }
  h2 { font-size: 1.5rem; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

@media print {
  .toc { display: none; }
  section { break-inside: avoid; }
  .mermaid-wrapper { break-inside: avoid; }
  .lang-switcher { display: none; }
}

/* ── Language Switcher ──────────────────────────────── */
.lang-switcher {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 200;
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  font-size: 0.8rem;
  font-weight: 600;
}
.lang-switcher a {
  padding: 6px 14px;
  color: var(--gh-text-muted);
  text-decoration: none;
  background: var(--card-bg);
  transition: all 0.2s;
}
.lang-switcher a:hover {
  color: var(--gh-text);
  background: rgba(88,166,255,0.1);
  text-decoration: none;
}
.lang-switcher a.active {
  color: var(--gh-dark);
  background: var(--gh-cyan);
  pointer-events: none;
}
