/* ================================================================
   SURFACEGUARD — SECURITY SCANNER REFERENCE (/learn)  v20260414
   Two-column: sticky category nav + scanner cards.
   Extends the same design token set as info-page.
   ================================================================ */

:root {
    --bg:             #070b0f;
    --panel:          #0c1420;
    --panel-raised:   #0f1929;
    --border:         rgba(255, 255, 255, 0.07);
    --border-accent:  rgba(56, 217, 230, 0.28);
    --text-primary:   #ecf3ff;
    --text-body:      #b8cfe8;
    --text-meta:      #7a95b4;
    --accent:         #38d9e6;
    --accent2:        #4fd1c5;
    --accent-glow:    rgba(56, 217, 230, 0.10);
    --accent-glow2:   rgba(56, 217, 230, 0.05);

    /* Severity */
    --sev-critical:      #ef4444;
    --sev-critical-bg:   rgba(239, 68,  68,  0.10);
    --sev-critical-bdr:  rgba(239, 68,  68,  0.28);
    --sev-high:          #f97316;
    --sev-high-bg:       rgba(249, 115, 22,  0.10);
    --sev-high-bdr:      rgba(249, 115, 22,  0.28);
    --sev-medium:        #eab308;
    --sev-medium-bg:     rgba(234, 179, 8,   0.10);
    --sev-medium-bdr:    rgba(234, 179, 8,   0.28);
    --sev-low:           #22c55e;
    --sev-low-bg:        rgba(34,  197, 94,  0.08);
    --sev-low-bdr:       rgba(34,  197, 94,  0.22);
    --sev-info:          #6366f1;
    --sev-info-bg:       rgba(99,  102, 241, 0.10);
    --sev-info-bdr:      rgba(99,  102, 241, 0.28);

    /* Result boxes */
    --pass-bg:     rgba(34,  197, 94,  0.06);
    --pass-bdr:    rgba(34,  197, 94,  0.20);
    --pass-label:  #4ade80;
    --find-bg:     rgba(239, 68,  68,  0.06);
    --find-bdr:    rgba(239, 68,  68,  0.20);
    --find-label:  #f87171;

    /* Radius */
    --r-sm:  6px;
    --r-md:  10px;
    --r-lg:  14px;
    --r-xl:  18px;
}

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

body {
    font-family: "Inter", "Segoe UI", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    background:
        radial-gradient(ellipse 70% 50% at 95% 0%,   rgba(56, 217, 230, 0.07) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 5%  100%, rgba(79, 209, 197, 0.05) 0%, transparent 50%),
        linear-gradient(180deg, #070b0f 0%, #080e17 100%);
    color: var(--text-primary);
    min-height: 100vh;
}

/* ── Reading progress bar ───────────────────────────────────────── */
.progress-bar {
    position: fixed;
    top: 0; left: 0;
    height: 2px; width: 0%;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent2) 60%, transparent 100%);
    z-index: 200;
    pointer-events: none;
    transition: width 80ms linear;
    box-shadow: 0 0 12px rgba(56, 217, 230, 0.5);
}

/* ── Outer shell ────────────────────────────────────────────────── */
.learn-shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px 120px;
}

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 22px 0 26px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.01em;
    transition: opacity 0.18s ease;
}
.brand:hover { opacity: 0.82; }
.brand img   { width: 32px; height: 32px; }
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 16px;
    color: var(--text-meta);
    text-decoration: none;
    font-size: 0.83rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.back-link .back-arrow {
    font-style: normal;
    transition: transform 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.back-link:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    background: var(--accent-glow2);
}
.back-link:hover .back-arrow { transform: translateX(-4px); }

/* ── Hero ───────────────────────────────────────────────────────── */
.learn-hero {
    padding: 56px 0 52px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}
.learn-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid var(--border-accent);
    padding: 4px 12px;
    border-radius: 99px;
    margin-bottom: 20px;
}
.learn-hero h1 {
    font-size: clamp(2rem, 4vw, 2.9rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin-bottom: 16px;
    background: linear-gradient(140deg, #ecf3ff 0%, #9bbbd8 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.learn-hero-sub {
    font-size: 1rem;
    color: var(--text-body);
    line-height: 1.65;
    max-width: 660px;
    margin-bottom: 28px;
}
.learn-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.learn-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 0.78rem;
    color: var(--text-meta);
    font-weight: 500;
}
.learn-stat-pill svg {
    width: 13px; height: 13px;
    color: var(--accent);
    flex-shrink: 0;
}

/* ── Two-column body ────────────────────────────────────────────── */
.learn-body {
    display: flex;
    gap: 52px;
    align-items: stretch;   /* sidebar stretches to full content height → sticky works */
    padding-top: 52px;
}

/* ── Sidebar / Category nav ─────────────────────────────────────── */
.learn-sidebar {
    width: 218px;
    flex-shrink: 0;
}
#learn-nav {
    position: sticky;
    top: 88px;
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
#learn-nav::-webkit-scrollbar { display: none; }

.nav-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-meta);
    opacity: 0.6;
    margin-bottom: 12px;
    padding-left: 16px;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
    border-left: 1px solid var(--border);
}
.nav-list li { margin: 0; }
.nav-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: var(--text-meta);
    text-decoration: none;
    font-size: 0.8rem;
    line-height: 1.4;
    border-left: 2px solid transparent;
    margin-left: -1px;
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.nav-list a:hover {
    color: var(--text-primary);
    border-left-color: rgba(56, 217, 230, 0.35);
    background: var(--accent-glow2);
}
.nav-list a.active {
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
    background: var(--accent-glow);
}
.nav-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
    color: var(--text-meta);
    letter-spacing: 0;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.nav-list a.active .nav-icon,
.nav-list a:hover  .nav-icon {
    color: var(--accent);
    background: var(--accent-glow);
    border-color: var(--border-accent);
}
.nav-count {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-meta);
    opacity: 0.5;
    font-variant-numeric: tabular-nums;
}
.nav-list a.active .nav-count { opacity: 1; color: var(--accent); }

/* ── Main content area ──────────────────────────────────────────── */
.learn-content {
    flex: 1;
    min-width: 0;
}

/* ── Category section ───────────────────────────────────────────── */
.category-section {
    margin-bottom: 72px;
    scroll-margin-top: 88px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.42s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.category-section.in-view { opacity: 1; transform: translateY(0); }

.category-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding-bottom: 24px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border);
}
.cat-icon {
    width: 44px; height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow);
    border: 1px solid var(--border-accent);
    border-radius: var(--r-md);
    color: var(--accent);
}
.cat-icon svg { width: 20px; height: 20px; }

.cat-title-block { flex: 1; min-width: 0; }
.cat-title-block h2 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 6px;
    line-height: 1.25;
}
.cat-title-block p {
    font-size: 0.875rem;
    color: var(--text-body);
    line-height: 1.6;
    margin: 0;
}
.cat-score-tag {
    flex-shrink: 0;
    font-size: 0.67rem;
    font-weight: 700;
    font-family: "JetBrains Mono", "Fira Code", monospace;
    color: var(--text-meta);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: var(--r-sm);
    letter-spacing: 0.02em;
    white-space: nowrap;
    margin-top: 3px;
}

/* ── Scanner card ───────────────────────────────────────────────── */
.scanner-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    margin-bottom: 20px;
    overflow: hidden;
    transition: border-color 0.22s ease, box-shadow 0.22s ease;
}
.scanner-card:hover {
    border-color: rgba(56, 217, 230, 0.18);
    box-shadow: 0 4px 28px rgba(0,0,0,0.25), 0 0 0 1px rgba(56, 217, 230, 0.05);
}

/* Card header */
.sc-head {
    padding: 20px 24px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--panel-raised);
}
.sc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.issue-code {
    font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", "Courier New", monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-glow);
    border: 1px solid var(--border-accent);
    padding: 2px 9px;
    border-radius: var(--r-sm);
    letter-spacing: 0.04em;
}

/* Severity badges */
.sev-badge {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 9px;
    border-radius: var(--r-sm);
    border: 1px solid;
}
.sev-badge.sev-critical { color: var(--sev-critical); background: var(--sev-critical-bg); border-color: var(--sev-critical-bdr); }
.sev-badge.sev-high     { color: var(--sev-high);     background: var(--sev-high-bg);     border-color: var(--sev-high-bdr);     }
.sev-badge.sev-medium   { color: var(--sev-medium);   background: var(--sev-medium-bg);   border-color: var(--sev-medium-bdr);   }
.sev-badge.sev-low      { color: var(--sev-low);      background: var(--sev-low-bg);      border-color: var(--sev-low-bdr);      }
.sev-badge.sev-info     { color: var(--sev-info);     background: var(--sev-info-bg);     border-color: var(--sev-info-bdr);     }

.sc-phase {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-meta);
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    padding: 2px 8px;
    border-radius: var(--r-sm);
    letter-spacing: 0.04em;
}

.sc-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    line-height: 1.3;
}

/* Card body */
.sc-body {
    padding: 0 24px;
}

/* Sub-section */
.sc-section {
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}
.sc-section:last-child { border-bottom: none; }

.sc-section h4 {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-meta);
    margin-bottom: 10px;
}
.sc-section p {
    font-size: 0.875rem;
    color: var(--text-body);
    line-height: 1.7;
}
.sc-section p + p { margin-top: 10px; }

.sc-section ul,
.sc-section ol {
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.sc-section li {
    font-size: 0.875rem;
    color: var(--text-body);
    line-height: 1.6;
}
.sc-section li::marker { color: var(--accent); }

/* Inline code in prose */
.sc-section code {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.8em;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 1px 5px;
    border-radius: 4px;
}

/* Code block (fix steps) */
.sc-code {
    margin-top: 12px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--r-md);
    padding: 12px 16px;
    overflow-x: auto;
}
.sc-code code {
    font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.78rem;
    color: #a3e4d7;
    background: none;
    padding: 0;
    border-radius: 0;
    white-space: pre;
    display: block;
    line-height: 1.6;
}

/* ── Result comparison boxes ────────────────────────────────────── */
.sc-results {
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.sr-pass,
.sr-finding {
    border-radius: var(--r-md);
    padding: 14px 16px;
    overflow: hidden;
}
.sr-pass    { background: var(--pass-bg); border: 1px solid var(--pass-bdr); }
.sr-finding { background: var(--find-bg); border: 1px solid var(--find-bdr); }

.sr-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 10px;
}
.sr-pass    .sr-label { color: var(--pass-label); }
.sr-finding .sr-label { color: var(--find-label); }
.sr-label svg { width: 12px; height: 12px; flex-shrink: 0; }

.sr-output {
    font-family: "JetBrains Mono", "Fira Code", monospace;
    font-size: 0.72rem;
    line-height: 1.65;
    white-space: pre;
    color: var(--text-body);
    overflow-x: auto;
}
.sr-pass    .sr-output { color: #a7f3d0; }
.sr-finding .sr-output { color: #fca5a5; }

/* ── Card footer — framework tags ───────────────────────────────── */
.sc-foot {
    padding: 14px 24px;
    background: rgba(0,0,0,0.15);
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.sc-foot-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-meta);
    opacity: 0.5;
    margin-right: 4px;
}
.fw-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.fw-owasp { color: #fb923c; background: rgba(251,146,60,0.08);  border-color: rgba(251,146,60,0.25); }
.fw-cwe   { color: #a78bfa; background: rgba(167,139,250,0.08); border-color: rgba(167,139,250,0.25); }
.fw-cvss  { color: #f87171; background: rgba(248,113,113,0.08); border-color: rgba(248,113,113,0.22); }
.fw-rfc   { color: #60a5fa; background: rgba(96,165,250,0.08);  border-color: rgba(96,165,250,0.22); }
.fw-nist  { color: #34d399; background: rgba(52,211,153,0.08);  border-color: rgba(52,211,153,0.22); }
.fw-asvs  { color: #38bdf8; background: rgba(56,189,248,0.08);  border-color: rgba(56,189,248,0.22); }
.fw-mitre { color: #f472b6; background: rgba(244,114,182,0.08); border-color: rgba(244,114,182,0.22); }
.fw-cis   { color: #a3e635; background: rgba(163,230,53,0.08);  border-color: rgba(163,230,53,0.22); }

/* ── Stub / coming-soon placeholder ────────────────────────────── */
.scanner-stub {
    border: 1px dashed rgba(255,255,255,0.08);
    border-radius: var(--r-xl);
    padding: 36px 28px;
    text-align: center;
}
.scanner-stub-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-meta);
    opacity: 0.45;
    margin-bottom: 8px;
}
.scanner-stub p {
    font-size: 0.84rem;
    color: var(--text-meta);
    opacity: 0.5;
    line-height: 1.6;
}
.scanner-stub .stub-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-top: 16px;
}
.stub-pill {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: "JetBrains Mono", monospace;
    color: var(--text-meta);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: var(--r-sm);
    opacity: 0.6;
}

/* ── Back to top ────────────────────────────────────────────────── */
#back-to-top {
    position: fixed;
    bottom: 32px; right: 28px;
    width: 40px; height: 40px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-meta);
    text-decoration: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease, border-color 0.18s ease, color 0.18s ease;
    z-index: 50;
}
#back-to-top.visible { opacity: 1; pointer-events: auto; }
#back-to-top:hover   { color: var(--accent); border-color: var(--border-accent); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .learn-body     { flex-direction: column; gap: 32px; }
    .learn-sidebar  { width: 100%; }
    #learn-nav      { position: static; max-height: none; }
    .nav-list       { flex-direction: row; flex-wrap: wrap; border-left: none; gap: 6px; }
    .nav-list a     { border-left: none; border-bottom: 2px solid transparent; border-radius: var(--r-sm); padding: 6px 12px; }
    .nav-list a.active { border-left: none; border-bottom-color: var(--accent); }
    .nav-count      { display: none; }
    .sc-results     { grid-template-columns: 1fr; }
    .cat-score-tag  { display: none; }
}
@media (max-width: 600px) {
    .learn-shell { padding: 0 16px 80px; }
    .learn-hero  { padding: 36px 0 36px; }
    .sc-head, .sc-body, .sc-foot { padding-left: 16px; padding-right: 16px; }
    .sr-output { font-size: 0.68rem; }
}
