/* ═══════════════════════════════════════════════════
   Kleckerbox PKI – main.css
   Shared across CRL, OCSP, CA
   ═══════════════════════════════════════════════════ */

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

:root {
  --bg:       #0d0f14;
  --bg2:      #13161e;
  --bg3:      #1a1d27;
  --border:   #2a2d3a;
  --border2:  #3a3d50;
  --accent:   #4f8ef7;
  --accent2:  #2563eb;
  --purple:   #a78bfa;
  --teal:     #2dd4bf;
  --green:    #22c55e;
  --red:      #ef4444;
  --amber:    #f59e0b;
  --text:     #e2e8f0;
  --text2:    #94a3b8;
  --text3:    #64748b;
  --mono:     'JetBrains Mono', monospace;
  --sans:     'Inter', sans-serif;
  --r:        8px;
  --rl:       12px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── NAV ─────────────────────────────────────────── */
nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-brand img { height: 30px; width: auto; }

.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
  white-space: nowrap;
}

.nav-links a:hover  { color: var(--accent); }
.nav-links a.active { color: var(--text); font-weight: 600; }

/* Divider in nav */
.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border2);
  flex-shrink: 0;
}

/* Mobile burger */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border2);
  border-radius: var(--r);
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}

.nav-burger span {
  display: block;
  height: 2px;
  background: var(--text2);
  border-radius: 2px;
  transition: all 0.25s;
}

/* Mobile menu overlay */
.nav-mobile {
  display: none;
  position: fixed;
  top: 60px;
  left: 0;
  right: 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  z-index: 99;
  padding: 1rem 1.5rem 1.25rem;
  flex-direction: column;
  gap: 0;
}

.nav-mobile.open { display: flex; }

.nav-mobile a {
  color: var(--text2);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-mobile a:last-child { border-bottom: none; }
.nav-mobile a:hover  { color: var(--accent); }
.nav-mobile a.active { color: var(--text); font-weight: 600; }

@media (max-width: 785px) {
  nav { padding: 0 1rem; }
  .nav-links  { display: none; }
  .nav-burger { display: flex; }
}

/* ── HERO ────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--bg2) 0%, #0f1420 100%);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 99px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.hero p {
  color: var(--text2);
  font-size: 0.95rem;
  max-width: 560px;
  margin: 0 auto 1.25rem;
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
  .hero p  { font-size: 0.85rem; }
}

/* Status pill in hero */
.responder-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 16px;
  font-size: 0.78rem;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

.responder-status .rs-host {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text3);
  word-break: break-all;
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.6); animation: pulse 2s infinite; }
.dot-red   { background: var(--red);   box-shadow: 0 0 6px rgba(239,68,68,0.5); }

@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:0.5;} }

/* ── LAYOUT ──────────────────────────────────────── */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

@media (max-width: 768px) { main { padding: 1.5rem 1rem; } }

/* ── SECTION HEADER ──────────────────────────────── */
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 1.25rem; }

.section-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.section-title { font-size: 1.1rem; font-weight: 600; }
.section-sub   { font-size: 0.8rem; color: var(--text3); margin-top: 1px; }

/* ── STATS BAR ───────────────────────────────────── */
.stats-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1rem;
  text-align: center;
}

.stat-num   { font-size: 1.5rem; font-weight: 600; font-family: var(--mono); }
.stat-label { font-size: 0.72rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }

/* ── CARDS ───────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  overflow: hidden;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border2); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem 0.85rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.card-body   { padding: 1rem 1.25rem; }
.card-footer { display: flex; gap: 8px; flex-wrap: wrap; padding: 0.75rem 1.25rem 1rem; border-top: 1px solid var(--border); }

/* ── DATA ROWS ───────────────────────────────────── */
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.35rem 1.5rem; }
@media (max-width: 600px) { .data-grid { grid-template-columns: 1fr; } }

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 4px 0;
  font-size: 0.79rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.data-row:last-child { border-bottom: none; }

.data-label { color: var(--text3); font-weight: 500; min-width: 90px; flex-shrink: 0; }
.data-value { font-family: var(--mono); font-size: 0.74rem; color: var(--text2); text-align: right; word-break: break-all; max-width: 260px; }

/* ── BADGES ──────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 0.7rem; font-weight: 600; }
.badge-green  { background: rgba(34,197,94,0.12);   color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.badge-amber  { background: rgba(245,158,11,0.12);  color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.badge-red    { background: rgba(239,68,68,0.12);   color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.badge-purple { background: rgba(167,139,250,0.12); color: #c4b5fd; border: 1px solid rgba(167,139,250,0.25); }
.badge-blue   { background: rgba(79,142,247,0.12);  color: #93c5fd; border: 1px solid rgba(79,142,247,0.25); }
.badge-teal   { background: rgba(45,212,191,0.12);  color: #5eead4; border: 1px solid rgba(45,212,191,0.25); }

/* ── BUTTONS ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--r);
  font-size: 0.79rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid;
  transition: all 0.15s;
  font-family: var(--sans);
  white-space: nowrap;
}

.btn-sm { padding: 5px 10px; font-size: 0.73rem; }

.btn-purple { background: #a78bfa; border-color: #a78bfa; color: #fff; }
.btn-purple:hover { background: #7c3aed; border-color: #7c3aed; }

.btn-blue { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-blue:hover { background: var(--accent2); border-color: var(--accent2); }

.btn-teal { background: var(--teal); border-color: var(--teal); color: #0d1117; }
.btn-teal:hover { background: #14b8a6; border-color: #14b8a6; }

.btn-outline { background: transparent; border-color: var(--border2); color: var(--text2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: rgba(79,142,247,0.05); }

/* ── FORMS ───────────────────────────────────────── */
.form-label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--text2); margin-bottom: 0.4rem; }
.form-hint  { font-size: 0.74rem; color: var(--text3); margin-bottom: 0.6rem; line-height: 1.5; }

textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 0.7rem 0.9rem;
  resize: vertical;
  min-height: 160px;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}

/* ── DETAILS / RAW ───────────────────────────────── */
details { margin-top: 0.65rem; }

details summary {
  cursor: pointer;
  font-size: 0.77rem;
  color: var(--text3);
  padding: 5px 10px;
  background: var(--bg3);
  border-radius: var(--r);
  border: 1px solid var(--border);
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s, border-color 0.2s;
}

details summary:hover { color: var(--text2); border-color: var(--border2); }
details summary::before { content: '▶'; font-size: 0.58rem; transition: transform 0.2s; }
details[open] summary::before { transform: rotate(90deg); }
details[open] summary { border-radius: var(--r) var(--r) 0 0; }

.raw-output {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--r) var(--r);
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text2);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
  line-height: 1.6;
}

/* ── INFO BOX ────────────────────────────────────── */
.info-box {
  border-radius: var(--r);
  padding: 0.9rem 1.1rem;
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.7;
}

/* ── EXPLAIN CARDS ───────────────────────────────── */
.explain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }

.explain-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--rl);
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s;
}

.explain-card:hover { border-color: var(--border2); }

.explain-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.explain-num   { font-family: var(--mono); font-size: 1.8rem; font-weight: 600; line-height: 1; margin-bottom: 0.5rem; }
.explain-title { font-size: 0.86rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.explain-text  { font-size: 0.79rem; color: var(--text2); line-height: 1.65; }

/* ── CMD CARDS ───────────────────────────────────── */
.cmd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 1rem; }

.cmd-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.cmd-title { padding: 0.6rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.78rem; font-weight: 500; color: var(--text2); }
.cmd-row   { padding: 0.7rem 1rem; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.cmd-code  { font-family: var(--mono); font-size: 0.7rem; color: var(--purple); word-break: break-all; flex: 1; line-height: 1.6; }

/* ── RESULT BLOCKS ───────────────────────────────── */
.result-block { border-radius: var(--r); padding: 1.1rem 1.25rem; border-left: 3px solid transparent; }
.result-good    { background: rgba(34,197,94,0.06);  border-left-color: var(--green); }
.result-revoked { background: rgba(239,68,68,0.06);  border-left-color: var(--red); }
.result-unknown { background: rgba(245,158,11,0.06); border-left-color: var(--amber); }
.result-error   { background: rgba(245,158,11,0.06); border-left-color: var(--amber); }

.result-status { font-size: 0.95rem; font-weight: 600; display: flex; align-items: center; gap: 8px; margin-bottom: 0.5rem; }
.result-status.green { color: #4ade80; }
.result-status.red   { color: #f87171; }
.result-status.amber { color: #fbbf24; }

.result-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.5rem; margin-top: 0.75rem; }
.meta-item { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r); padding: 0.6rem 0.75rem; }
.meta-label { font-size: 0.7rem; color: var(--text3); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.meta-value { font-family: var(--mono); font-size: 0.76rem; color: var(--text2); word-break: break-all; }

/* ── INSTALL STEPS ───────────────────────────────── */
.install-steps { display: flex; flex-direction: column; gap: 0.85rem; }
.install-step  { display: flex; gap: 1rem; align-items: flex-start; }

.install-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 0.78rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 2px;
}

.install-title { font-size: 0.85rem; font-weight: 500; color: var(--text); margin-bottom: 4px; }
.install-text  { font-size: 0.79rem; color: var(--text2); line-height: 1.6; }

/* ── TREE (CA hierarchy) ─────────────────────────── */
.tree { display: flex; flex-direction: column; gap: 0; }
.tree-item { display: flex; align-items: stretch; }
.tree-connector { display: flex; flex-direction: column; align-items: center; width: 40px; flex-shrink: 0; padding-top: 24px; }
.tree-connector .line { width: 2px; flex: 1; min-height: 40px; }
.tree-connector .dot  { width: 12px; height: 12px; border-radius: 50%; border: 2px solid; flex-shrink: 0; margin-bottom: 4px; }
.tree-item:last-child .tree-connector .line { display: none; }
.tree-card-wrap { flex: 1; padding: 0 0 1.25rem 0.5rem; min-width: 0; }

/* ── CRL GRID ────────────────────────────────────── */
.crl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
@media (max-width: 480px) { .crl-grid { grid-template-columns: 1fr; } }

/* ── FOOTER ──────────────────────────────────────── */
footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

footer img { height: 24px; opacity: 0.7; }

footer .footer-copy { font-size: 0.78rem; color: var(--text3); }
footer .footer-copy a { color: var(--accent); text-decoration: none; }

@media (max-width: 480px) { footer { padding: 1rem; } }

/* ── SCROLLBAR ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a4d60; }

/* ── ANCHOR OFFSET (sticky nav = 60px) ──────────────── */
[id] { scroll-margin-top: 76px; }

/* ── ANIMATIONS ──────────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.animate-up { animation: fadeUp 0.4s ease both; }
