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

:root {
    --bg-primary: #050506;
    --bg-secondary: #0a0a0c;
    --bg-card: #0c0c12;
    --bg-card-hover: #14141c;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #22c55e;
    --accent-glow: rgba(34, 197, 94, 0.5);
    --border: #1a1a24;
    --border-hover: #252532;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background layers - use GPU compositing */
.bg-gradient {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse 80% 50% at 20% -20%, rgba(239, 68, 68, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 20%, rgba(139, 92, 246, 0.06), transparent),
        radial-gradient(ellipse 50% 30% at 50% 100%, rgba(34, 197, 94, 0.08), transparent);
    pointer-events: none;
    z-index: 0;
    will-change: opacity;
    animation: gradientPulse 20s ease infinite;
}

@keyframes gradientPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image: 
        linear-gradient(rgba(34, 197, 94, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 197, 94, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
    mask-image: radial-gradient(ellipse at center, black 0%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 80%);
    will-change: transform;
    animation: gridScroll 60s linear infinite;
}

@keyframes gridScroll {
    to { transform: translateY(50px); }
}

/* Brand */
.brand {
    display: inline-block;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    padding: 0.6rem 1.2rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(34, 197, 94, 0.03) 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    position: relative;
}

.brand::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    opacity: 0.7;
}

/* Main Content */
main {
    position: relative;
    z-index: 5;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    padding-top: 3rem;
}

/* Category Sections */
.category {
    margin-bottom: 4rem;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.category:first-child {
    margin-top: 0;
}

.category.visible {
    opacity: 1;
    transform: translateY(0);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(34, 197, 94, 0.02) 100%);
    border-radius: 16px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.category-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.08), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.category-header:hover::before {
    transform: translateX(100%);
}

.category-header i {
    font-size: 1.5rem;
    color: var(--accent);
    opacity: 0.9;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.category-header h2 {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Cards Grid */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

/* Card Styles */
.card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(145deg, var(--bg-card) 0%, rgba(12, 12, 18, 0.95) 100%);
    border: 1px solid var(--border);
    border-radius: 16px;
    text-decoration: none;
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    isolation: isolate;
    contain: layout style paint;
    transition: border-color 0.4s ease, 
                background 0.4s ease, 
                box-shadow 0.4s ease;
}

/* Shield background */
.card-shield {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(34, 197, 94, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 100%, rgba(34, 197, 94, 0.05) 0%, transparent 40%);
    z-index: 0;
    transition: background 0.4s ease;
}

/* Security scan line */
.card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, transparent, rgba(34, 197, 94, 0.03), transparent);
    animation: securityScan 4s ease-in-out infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes securityScan {
    0%, 100% { top: -50%; opacity: 0; }
    10% { opacity: 1; }
    50% { top: 100%; opacity: 1; }
    60%, 100% { opacity: 0; }
}

/* Secure border */
.card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg, 
        rgba(34, 197, 94, 0.3) 0%, 
        transparent 30%, 
        transparent 70%, 
        rgba(34, 197, 94, 0.2) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* Card glow - hidden */
.card-glow {
    display: none;
}

/* Lock icon */
.card-secure-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.75rem;
    color: var(--accent);
    opacity: 0.6;
    z-index: 10;
    filter: drop-shadow(0 0 4px var(--accent-glow));
    transition: opacity 0.3s ease, transform 0.3s ease, filter 0.3s ease;
}

.card:hover .card-secure-icon {
    opacity: 1;
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.card:hover {
    border-color: rgba(34, 197, 94, 0.4);
    background: linear-gradient(145deg, var(--bg-card-hover) 0%, rgba(34, 197, 94, 0.03) 100%);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(34, 197, 94, 0.2),
        0 0 80px -20px var(--accent-glow);
}

.card:hover .card-shield {
    background: 
        radial-gradient(ellipse at 50% 0%, rgba(34, 197, 94, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 100%, rgba(34, 197, 94, 0.1) 0%, transparent 50%);
}

.card-logo {
    font-size: 1.3rem;
    font-weight: 700;
    position: relative;
    z-index: 2;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    padding: 0.5rem 1rem;
}

.card:hover .card-logo {
    color: var(--accent);
    text-shadow: 0 0 30px var(--accent-glow);
}

.card:active {
    transform: scale(0.98);
}

/* Footer */
footer {
    position: relative;
    z-index: 5;
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--accent);
}

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

    .brand {
        font-size: 0.85rem;
        margin-bottom: 2rem;
        padding: 0.5rem 1rem;
    }

    .category-header {
        padding: 1rem;
    }

    .category-header i {
        font-size: 1.25rem;
    }

    .category-header h2 {
        font-size: 1.1rem;
    }

    .cards {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .card {
        padding: 1.5rem 1rem;
    }

    .card-logo {
        font-size: 1rem;
    }

    .card-secure-icon {
        top: 8px;
        right: 8px;
        font-size: 0.65rem;
    }

    .bg-grid {
        display: none;
    }
}

@media (max-width: 400px) {
    .cards {
        grid-template-columns: 1fr;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    #threatContainer {
        display: none !important;
    }
}

/* Focus states */
.card:focus {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.card:focus:not(:focus-visible) {
    outline: none;
}

.card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

/* Selection */
::selection {
    background: var(--accent);
    color: #000;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--border), var(--border-hover));
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--border-hover), var(--accent));
}

/* Card reveal animation */
.card {
    opacity: 0;
    animation: cardReveal 0.6s ease forwards;
}

.cards .card:nth-child(1) { animation-delay: 0.1s; }
.cards .card:nth-child(2) { animation-delay: 0.15s; }
.cards .card:nth-child(3) { animation-delay: 0.2s; }
.cards .card:nth-child(4) { animation-delay: 0.25s; }
.cards .card:nth-child(5) { animation-delay: 0.3s; }

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
