/* ============================================================
   ThreatWeaver — Vercel / shadcn inspired design system
   ============================================================ */

:root {
    --background: #000000;
    --surface: #0a0a0a;
    --surface-2: #111111;
    --surface-hover: #161616;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --foreground: #ededed;
    --muted: #a1a1a1;
    --muted-2: #707070;
    --ring: rgba(255, 255, 255, 0.55);
    --radius: 0.75rem;
}

* {
    border-color: var(--border);
}

html {
    background: var(--background);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Page background — pure black with a subtle dotted grid + top glow */
.tw-body {
    background-color: #000;
    color: var(--foreground);
    position: relative;
}

.tw-grid-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 22px 22px;
    background-position: -1px -1px;
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 35%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 35%, transparent 100%);
}

.tw-body::before {
    content: '';
    position: fixed;
    top: -20%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    height: 480px;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.06), transparent 70%);
    filter: blur(20px);
}

/* ---------------- Typography helpers ---------------- */
.page-title {
    font-size: 1.6rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #fff;
}

.page-subtitle {
    color: var(--muted);
    font-size: 0.875rem;
    margin-top: 0.35rem;
}

.section-title {
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #fff;
}

.eyebrow {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--muted-2);
    font-weight: 500;
}

/* ---------------- Card ---------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.02) inset,
                0 8px 24px -12px rgba(0, 0, 0, 0.8);
}

.card-pad {
    padding: 1.5rem;
}

.card-hover {
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.card-hover:hover {
    border-color: var(--border-strong);
    background: var(--surface-2);
}

.surface-inset {
    background: #050505;
    border: 1px solid var(--border);
    border-radius: 0.625rem;
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    padding: 0 0.95rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
    user-select: none;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-primary {
    background: #fff;
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    background: #e2e2e2;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--foreground);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: transparent;
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.25);
}

.btn-danger:hover:not(:disabled) {
    background: rgba(248, 113, 113, 0.10);
    border-color: rgba(248, 113, 113, 0.45);
}

.btn-sm {
    height: 2rem;
    font-size: 0.8125rem;
    padding: 0 0.75rem;
}

/* ---------------- Inputs ---------------- */
.input {
    width: 100%;
    background: #050505;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0 0.85rem;
    height: 2.5rem;
    font-size: 0.875rem;
    color: var(--foreground);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
    color: var(--muted-2);
}

.input:focus {
    outline: none;
    border-color: var(--border-strong);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}

.label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

/* ---------------- Badges ---------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    white-space: nowrap;
}

.badge-dot {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: currentColor;
}

.badge-neutral { color: var(--muted); }
.badge-mono { font-family: var(--font-mono, "Geist Mono", monospace); }

.badge-green   { color: #4ade80; border-color: rgba(74, 222, 128, 0.30); background: rgba(74, 222, 128, 0.10); }
.badge-amber   { color: #fbbf24; border-color: rgba(251, 191, 36, 0.30); background: rgba(251, 191, 36, 0.10); }
.badge-red     { color: #f87171; border-color: rgba(248, 113, 113, 0.30); background: rgba(248, 113, 113, 0.10); }
.badge-orange  { color: #fb923c; border-color: rgba(251, 146, 60, 0.30); background: rgba(251, 146, 60, 0.10); }
.badge-yellow  { color: #fde047; border-color: rgba(253, 224, 71, 0.30); background: rgba(253, 224, 71, 0.10); }
.badge-violet  { color: #c4b5fd; border-color: rgba(196, 181, 253, 0.30); background: rgba(196, 181, 253, 0.10); }
.badge-blue    { color: #93c5fd; border-color: rgba(147, 197, 253, 0.30); background: rgba(147, 197, 253, 0.10); }

/* ---------------- Tables ---------------- */
.tw-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.tw-table thead th {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 500;
    color: var(--muted-2);
    padding: 0 1rem 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.tw-table tbody td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.875rem;
    color: var(--foreground);
}

.tw-table tbody tr {
    transition: background 0.15s ease;
}

.tw-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.025);
}

.tw-table tbody tr:last-child td {
    border-bottom: none;
}

/* ---------------- Code blocks ---------------- */
.code-block {
    font-family: "Geist Mono", "JetBrains Mono", "Fira Code", monospace;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
}

.code-block code {
    font-size: 0.8125rem;
    color: #d4d4d4;
}

/* ---------------- Links ---------------- */
.link {
    color: var(--foreground);
    transition: color 0.15s ease;
    text-decoration: none;
}

.link:hover {
    color: #fff;
}

.link-muted {
    color: var(--muted);
}

.link-muted:hover {
    color: #fff;
}

/* ---------------- Scrollbar ---------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #262626; border-radius: 6px; border: 2px solid #000; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* ---------------- Animations ---------------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

main {
    animation: fadeIn 0.25s ease-out;
}

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); }
    70%  { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.pulse-ring {
    animation: pulse-ring 2s cubic-bezier(0.66, 0, 0, 1) infinite;
}

details summary::-webkit-details-marker { display: none; }
details summary::marker { content: ''; }

/* ---------------- Print ---------------- */
@media print {
    body { background: #fff !important; color: #000 !important; }
    nav, footer, .tw-grid-bg { display: none !important; }
    main { animation: none !important; }
    .card, .surface-inset { background: #fff !important; border-color: #e5e5e5 !important; box-shadow: none !important; }
    pre, code { background: #f7f7f7 !important; color: #111 !important; border: 1px solid #e5e5e5 !important; }
}


/* ============================================================
   Motion — tasteful entrance + state-change animations
   ============================================================ */

/* Staggered card entrance on page load */
@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

main > section,
main > div {
    animation: cardIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
main > *:nth-child(2)  { animation-delay: 0.04s; }
main > *:nth-child(3)  { animation-delay: 0.08s; }
main > *:nth-child(4)  { animation-delay: 0.12s; }
main > *:nth-child(5)  { animation-delay: 0.16s; }
main > *:nth-child(6)  { animation-delay: 0.20s; }
main > *:nth-child(7)  { animation-delay: 0.24s; }
main > *:nth-child(8)  { animation-delay: 0.28s; }
main > *:nth-child(9)  { animation-delay: 0.32s; }

/* Stepper circle pop when a step advances */
@keyframes popIn {
    0%   { transform: scale(0.4); opacity: 0; }
    60%  { transform: scale(1.18); }
    100% { transform: scale(1); opacity: 1; }
}
.step-pop { animation: popIn 0.42s cubic-bezier(0.2, 0.8, 0.2, 1.2); }

/* Mitigation card slide-in as findings land */
@keyframes slideFade {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}
.mit-in { animation: slideFade 0.45s ease both; }

/* Brief highlight flash on a value that just updated (token counter) */
@keyframes tkFlash {
    0%   { color: #fff; text-shadow: 0 0 12px rgba(255,255,255,0.5); }
    100% { color: inherit; text-shadow: none; }
}
.tk-flash { animation: tkFlash 0.7s ease; }

/* Smooth, springy transitions on interactive chrome */
.btn, .badge, .card-hover, .link, .link-muted, .tw-table tbody tr {
    transition: all 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.btn:active { transform: scale(0.97); }

/* Section dividers + connector lines animate their fill */
#pipelineStepper [data-line] { transition: background-color 0.4s ease; }
#pipelineStepper [data-circle] { transition: background-color 0.3s ease, border-color 0.3s ease; }

/* Live status badge shimmer */
@keyframes shimmer {
    0%   { opacity: 0.5; }
    50%  { opacity: 1; }
    100% { opacity: 0.5; }
}
#live-indicator { animation: shimmer 2.2s ease-in-out infinite; }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
