/**
 * ============================================================================
 * STYLE.CSS - The TechHub Design System
 * ============================================================================
 * Architecture: Glassmorphism / Semantic UI
 * Primary Palette: Zinc 950 / Vibrant Accents
 * Typography: Space Grotesk (Headings) / Inter (Body)
 * Features: Variable-driven themes, 3D transformations, and GPU-accelerated motion.
 * ============================================================================
 */

:root {
    color-scheme: dark;
    /* Base Dark Theme Colors */
    --bg-dark: #000000; /* Zinc 950 */
    --bg-card: rgba(24, 24, 27, 0.7); /* Zinc 900 */
    --bg-card-hover: rgba(39, 39, 42, 0.8); /* Zinc 800 */
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc; /* Slate 50 */
    --text-secondary: #a1a1aa; /* Zinc 400 */
    
    /* Global Accent (Synced with Home Page - Vibrant Violet/Purple) */
    --accent: #b89bfc; 
    
    /* Dynamic Topic Accents (Overridden by JS on subpages) */
    --topic-color: var(--accent);
    --topic-color-alpha: rgba(59, 130, 246, 0.2);

    /* Typography */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

/* Hide Default Cursor on devices with mice */

    body, a, button, input, select, textarea, .category-card, .resource-card {
        cursor: none !important;
    }




body {
    background-color: var(--bg-dark);
    /* Tech dot grid pattern */
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1.5px, transparent 1.5px);
    background-size: 30px 30px;
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Theme-colored grid for subpages! */
.topic-page {
    background-image: radial-gradient(var(--topic-color-grid, var(--topic-color-alpha)) 1.5px, transparent 1.5px);
}

/* ========================================================= */
/* BACKGROUND EFFECTS (Glowing Orbs) */
/* ========================================================= */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

.glow-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(110px);
    opacity: 0.25;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
    animation: drift 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.sphere-1 {
    top: -10%; left: -10%;
    width: 60vw; height: 60vw;
    background: #000d22; /* Blue */
}

.sphere-2 {
    bottom: -10%; right: -10%;
    width: 50vw; height: 50vw;
    background: #8b5cf6; /* Purple */
    animation-delay: -10s;
}

/* Dynamic colors for topic subpages */
.topic-page .topic-sphere-1 {
    top: -20%; right: -10%;
    width: 60vw; height: 60vw;
    background: var(--topic-color);
    opacity: 0.35;
}
.topic-page .topic-sphere-2 {
    bottom: -10%; left: -20%;
    width: 40vw; height: 40vw;
    background: var(--topic-color);
    opacity: 0.25;
    animation-delay: -5s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* ========================================================= */
/* NAVIGATION BAR */
/* ========================================================= */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 5%;
    background: rgba(9, 9, 11, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo, .logo a {
    font-family: 'Inter', sans-serif;
    font-size: 2.3rem;
    font-weight: 900;
    color: #ffffff !important;
    letter-spacing: -2px;
    display: flex;
    align-items: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.3s ease;
}

.logo:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 0 15px var(--topic-color-alpha));
}

.logo .logo-icon {
    display: none;
}

.logo .highlight {
    background: linear-gradient(135deg, var(--accent), #6ebaff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0;
    margin-left: 2px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -2px;
}

.logo-text-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    line-height: 1;
}

.logo-main {
    display: flex;
    align-items: center;
}

.logo-sup {
    font-family: var(--font-heading);
    font-size: 0.55rem;
    color: var(--text-secondary);
    letter-spacing: 0.25em;
    font-weight: 600;
    margin-bottom: 2px;
    margin-left: 1px;
    text-transform: uppercase;
    opacity: 0.8;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.35rem;
    border-radius: 100px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-left: 0;
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 1.25rem;
    border-radius: 100px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    background: transparent;
}

.nav-links a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.nav-links a.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.05), 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn-outline {
    background: var(--topic-color, var(--accent)) !important;
    color: var(--bg-dark) !important;
    font-weight: 700 !important;
    border: none !important;
    box-shadow: 0 4px 15px var(--topic-color-alpha, rgba(184, 155, 252, 0.2));
}

.btn-outline:hover {
    background: #fff !important;
    color: #000 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--topic-color-alpha);
}

.btn-outline:active {
    transform: translateY(1px) scale(0.96);
}

/* ========================================================= */
/* MAIN LAYOUT (Home Container) */
/* ========================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ========================================================= */
/* HERO SECTION */
/* ========================================================= */
.hero {
    text-align: center;
    padding: 6rem 0 4rem;
    animation: fadeInDown 0.8s ease-out backwards;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.1;
    letter-spacing: -1px;
}

.highlight-text {
    /* Beautiful linear gradient text for "Technology" */
    background: linear-gradient(135deg, #60a5fa, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    max-width: 600px;
    margin: 0 auto 3rem;
}

/* Search Bar */
.search-container {
    display: flex;
    max-width: 500px;
    margin: 0 auto;
    background: rgba(24, 24, 27, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50px; /* Pill shape */
    padding: 0.5rem;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.05), 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
    overflow: hidden; /* Clips any rectangular input background */
}

/* Topic specific default border overrides based on theme */
.topic-page .search-container {
    border-color: var(--topic-color);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.search-container:hover {
    transform: translateY(-5px);
    border-color: var(--topic-color);
    background: rgba(39, 39, 42, 0.6);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.06), 0 15px 35px -10px var(--topic-color-alpha);
}

.search-container:focus-within {
    border-color: var(--topic-color);
    background: rgba(39, 39, 42, 0.7);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.06), 0 15px 35px -10px var(--topic-color-alpha);
    transform: translateY(-5px);
}

.search-container input[type="text"] {
    flex: 1;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    outline: none !important;
    box-shadow: none !important;
}

.search-container input[type="text"]::placeholder {
    color: #52525b; /* Zinc 600 */
}

/* Fix for browser auto-fill forced background color */
.search-container input[type="text"]:-webkit-autofill,
.search-container input[type="text"]:-webkit-autofill:hover, 
.search-container input[type="text"]:-webkit-autofill:focus, 
.search-container input[type="text"]:-webkit-autofill:active {
    transition: background-color 5000s ease-in-out 0s;
    -webkit-text-fill-color: var(--text-primary) !important;
}

.search-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 1rem;
    font-size: 1.2rem;
    transition: transform 0.2s, color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn svg {
    filter: drop-shadow(0 0 0 rgba(0,0,0,0));
    transition: filter 0.3s ease;
}

.search-btn:hover {
    transform: scale(1.1);
    color: var(--topic-color);
}

.search-btn:hover svg {
    filter: drop-shadow(0 0 8px var(--topic-color));
}

.clear-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0.6;
}

.clear-btn:hover {
    opacity: 1;
    color: var(--topic-color);
    transform: scale(1.15) rotate(90deg);
}

/* ========================================================= */
/* CATEGORIES / TOPICS (Home Page Cards) */
/* ========================================================= */
.categories-section {
    padding: 4rem 0 6rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 2rem;
    color: var(--text-primary);
}

.section-header .line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-color), transparent);
}

/* Grid Layout */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.8rem;
}

/* Category Card Styling (Glassmorphism) */
.category-card {
    background: rgba(24, 24, 27, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-left: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.02), 0 8px 32px rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 2rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
}

.category-card.animate-in {
    opacity: 1 !important; /* Force visible */
    transform: translateY(0);
}

/* Subtle glow behind the card on hover */
.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Note: var(--card-color-alpha) comes from Javascript! */
    background: radial-gradient(circle at top right, var(--card-color-alpha), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.category-card:hover {
    border-color: var(--card-color);
    background: rgba(39, 39, 42, 0.6);
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.04), 0 8px 15px -10px var(--card-color-alpha);
}

.category-card:hover::before {
    opacity: 1;
}

.card-icon {
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.card-icon svg {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: block;
    margin: auto;
    object-fit: contain;
    overflow: visible;
    color: var(--text-primary);
    transition: color 0.4s ease, filter 0.4s ease;
}

.category-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    border-color: var(--card-color-alpha);
    box-shadow: inset 0 0 15px var(--card-color-alpha);
}

.category-card:hover .card-icon svg {
    color: var(--card-color);
    filter: drop-shadow(0 0 12px var(--card-color));
}

.card-path {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    opacity: 0.6;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.category-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    z-index: 1;
}

.category-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    z-index: 1;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.card-footer {
    display: flex;
    align-items: center;
    font-size: 0.95rem;
    color: var(--card-color);
    font-weight: 600;
    font-family: var(--font-heading);
    gap: 0.5rem;
    z-index: 1;
}

.card-footer i {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.category-card:hover .card-footer i {
    transform: translateX(6px);
}

/* ========================================================= */
/* TOPIC SUBPAGE STYLES */
/* ========================================================= */
.topic-hero {
    padding: 5rem 0 3rem;
    animation: fadeInDown 0.8s ease-out backwards;
}

/* Dynamic color pill */
.topic-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: var(--topic-color-alpha);
    color: var(--topic-color);
    border: 1px solid var(--topic-color);
    border-radius: 20px;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    box-shadow: 0 0 15px var(--topic-color-alpha);
}

.topic-hero h1 {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 6vw, 4.5rem);
    margin-bottom: 1rem;
    color: #fff;
    text-shadow: 0 0     30px var(--topic-color-alpha);
    letter-spacing: -1px;
}

.topic-description {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 700px;
}

/* ========================================================= */
/* RESOURCE FILTERS */
/* ========================================================= */
.filters {
    display: flex;
    gap: 1rem;
    margin: 0 0 3rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.filter-btn, .level-filter-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    height: 40px;
    padding: 0 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.filter-btn:hover, .level-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--topic-color-alpha);
}

.filter-btn.active, .level-filter-btn.active {
    background: var(--topic-color-alpha);
    border-color: var(--topic-color);
    color: #fff;
    box-shadow: 0 0 15px var(--topic-color-alpha);
}

/* ========================================================= */
/* RESOURCES GRID & ITEMS */
/* ========================================================= */
.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.8rem;
    padding-bottom: 6rem;
}

/* Resource Card with 3D Flip effect */
.resource-card {
    background: transparent;
    border: none;
    padding: 0;
    height: 420px; /* Increased from 380px to accommodate 5 lines of text */
    perspective: 1200px;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s ease;
}

.resource-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.resource-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: left;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
}

.resource-card.flipped .resource-card-inner {
    transform: rotateY(180deg);
}

.resource-card-front, .resource-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 1.5rem 1.5rem 4.5rem 1.5rem; /* Reduced padding to make room */
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Reduced gap from 1rem */
    overflow: hidden;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s ease, box-shadow 0.4s ease;
}

.resource-card-back {
    transform: rotateY(180deg);
    background: var(--bg-card-hover);
    justify-content: flex-start;
}

.resource-card:hover .resource-card-front {
    border-color: var(--topic-color, var(--accent));
    box-shadow: 0 10px 30px -15px var(--topic-color-alpha, var(--accent-alpha));
    transform: translateY(-3px);
}

.resource-card:hover .resource-card-back {
    border-color: var(--topic-color, var(--accent));
    box-shadow: 0 10px 30px -15px var(--topic-color-alpha, var(--accent-alpha));
    transform: rotateY(180deg) translateY(-3px);
}

.resource-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

/* Tag colors for types of resources */
.resource-type {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    background: var(--type-bg, rgba(255, 255, 255, 0.08));
    color: var(--type-color, var(--text-secondary));
    border: 1px solid var(--type-border, rgba(255, 255, 255, 0.1));
    font-weight: 600;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.resource-type svg {
    filter: drop-shadow(0 0 5px var(--type-shadow, transparent));
    transition: filter 0.3s ease;
}

/* Hardcoded thematic pills for standard types */
.resource-type[data-type="Video"] { 
    --type-color: #f87171; 
    --type-bg: rgba(248, 113, 113, 0.1); 
    --type-border: rgba(248, 113, 113, 0.25); 
    --type-shadow: rgba(248, 113, 113, 0.4); 
}

.resource-type[data-type="Website"] { 
    --type-color: #60a5fa; 
    --type-bg: rgba(96, 165, 250, 0.1); 
    --type-border: rgba(96, 165, 250, 0.25); 
    --type-shadow: rgba(96, 165, 250, 0.4); 
}

.resource-type[data-type="Note"], .resource-type[data-type="Notes"] { 
    --type-color: #fcd34d; 
    --type-bg: rgba(253, 211, 77, 0.1); 
    --type-border: rgba(253, 211, 77, 0.25); 
    --type-shadow: rgba(253, 211, 77, 0.4); 
}

.resource-level {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-heading);
}

.resource-card h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.resource-card p {
    color: var(--text-secondary);
    font-size: 0.92rem; /* Slightly smaller font to ensure 5 lines fit comfortably */
    line-height: 1.5;
    margin-bottom: 0.8rem; /* Reduced margin */
    display: -webkit-box;
    -webkit-line-clamp: 5;
    line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ========================================================= */
/* MODULE CARDS (Sub-Topics) */
/* ========================================================= */
.module-card .resource-card-front {
    background: var(--card-color-alpha);
    border: 1.5px solid rgba(255, 255, 255, 0.08); /* Slightly thicker */
    background: linear-gradient(135deg, rgba(24, 24, 27, 0.9), var(--card-color-alpha));
}

.module-card:hover .resource-card-front {
    border-color: var(--card-color);
    box-shadow: 0 12px 35px -18px var(--card-color-alpha);
    transform: translateY(-4px);
}

.module-card h3 {
    font-size: 1.5rem; /* Larger title for modules */
    font-weight: 700;
}

.module-card .resource-type[data-type="Module"] {
    color: var(--card-color);
    background: var(--card-color-alpha);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px var(--card-color-alpha);
}

.module-card .resource-type[data-type="Module"] svg {
    filter: drop-shadow(0 0 5px var(--card-color));
}

.module-card .resource-link {
    background: var(--card-color) !important;
    color: var(--bg-dark) !important;
    font-weight: 700;
}

.module-card .resource-link:hover {
    filter: brightness(1.1);
    box-shadow: 0 5px 15px var(--card-color);
}

/* Subject buttons on back of card */
.back-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.back-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.back-header h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-primary);
}

.btn-close-flip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-close-flip:hover {
    color: #fff;
    background: var(--topic-color-alpha);
    border-color: var(--topic-color);
    transform: rotate(90deg) scale(1.1);
}

.subject-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
    overflow-y: auto;
    padding: 0.5rem 0.5rem 0.5rem 0;
    flex: 1;
    scroll-behavior: smooth; /* Smooth for click-to-nav if used */
    scroll-padding: 10px;
    overscroll-behavior: contain;
}

/* Sophisticated scrollbar that appears only on interaction */
.subject-grid::-webkit-scrollbar {
    width: 3px;
}

.subject-grid::-webkit-scrollbar-track {
    background: transparent;
}

.subject-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05); /* Hidden by default */
    border-radius: 10px;
    transition: background 0.3s;
}

.subject-grid:hover::-webkit-scrollbar-thumb {
    background: var(--topic-color-alpha);
}

.subject-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1.2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    font-family: var(--font-heading);
    font-weight: 500;
    
    /* Use translate for hover so it perfectly escapes the animation lock */
    translate: 0 0;
    transition: background 0.3s ease, border-color 0.3s ease, translate 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
    
    /* Entry state */
    opacity: 0;
    transform: translateY(15px);
}

.resource-card.flipped .subject-btn {
    animation: subjectFadeIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes subjectFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Staggered delays for subjects */
.resource-card.flipped .subject-btn:nth-child(1) { animation-delay: 0.15s; }
.resource-card.flipped .subject-btn:nth-child(2) { animation-delay: 0.20s; }
.resource-card.flipped .subject-btn:nth-child(3) { animation-delay: 0.25s; }
.resource-card.flipped .subject-btn:nth-child(4) { animation-delay: 0.30s; }
.resource-card.flipped .subject-btn:nth-child(5) { animation-delay: 0.35s; }
.resource-card.flipped .subject-btn:nth-child(6) { animation-delay: 0.40s; }
.resource-card.flipped .subject-btn:nth-child(7) { animation-delay: 0.45s; }
.resource-card.flipped .subject-btn:nth-child(n+8) { animation-delay: 0.50s; }

.subject-btn:hover {
    background: var(--topic-color-alpha);
    border-color: var(--topic-color);
    translate: 6px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* The Call to Action Link inside the resource card */
.resource-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: absolute;
    bottom: 1.8rem;
    left: 1.8rem;
    padding: 0.75rem 1.2rem;
    background: var(--topic-color-alpha);
    color: #fff;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    width: fit-content;
    z-index: 5;
}

.resource-link:hover {
    background: var(--topic-color);
    box-shadow: 0 4px 20px var(--topic-color-alpha);
}

/* ========================================================= */
/* CUSTOM CURSOR */
/* ========================================================= */
.custom-cursor,
.custom-cursor-follower {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 9999;
    border-radius: 50%;
    /* Hardware acceleration for ultra-smooth rendering */
    will-change: transform; 
}

/* The solid inner dot */
.custom-cursor {
    width: 10px;
    height: 10px;
    /* Uses dynamic topic color if available, otherwise UI accent */
    background-color: var(--topic-color, var(--accent));
    box-shadow: 0 0 15px var(--topic-color, var(--accent));
    /* Remove transform transition to make it snappy (actual movement is via JS) */
    transition: width 0.2s, height 0.2s, background-color 0.3s ease, box-shadow 0.3s ease;
}

/* The outer ring (Ghost Follower) */
.custom-cursor-follower {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    /* Dynamic colored background on subpages */
    background-color: var(--topic-color-alpha, transparent);
    border-color: var(--topic-color, rgba(139, 92, 246, 0.4));
    backdrop-filter: blur(1px); /* Subtle blur for ghost effect */
    transition: width 0.3s cubic-bezier(0.23, 1, 0.32, 1), 
                height 0.3s cubic-bezier(0.23, 1, 0.32, 1), 
                border-width 0.3s ease, 
                border-color 0.3s ease, 
                background-color 0.3s ease,
                opacity 0.3s ease;
}

/* Mouse click convergence animation */
.custom-cursor-follower.mouse-down {
    width: 10px;
    height: 10px;
    border-color: transparent;
    background-color: var(--topic-color, var(--accent));
    opacity: 0.8;
}

/* Cursor Hover States (when hovering links/cards) */
.custom-cursor.hovering {
    width: 6px;
    height: 6px;
    background-color: snow !important;
    box-shadow: 0 0 10px snow !important;
}

.custom-cursor-follower.hovering {
    width: 50px;
    height: 50px;
    border-width: 1.2px;
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
}

/* Cursor Text Hover States (when hovering text inputs) */
.custom-cursor.text-hover {
    width: 2px;
    height: 24px;
    border-radius: 2px;
    /* Maintain the glowing effect but shaped like an I-beam */
}

.custom-cursor-follower.text-hover {
    /* Hide the follower ring completely when acting as a text cursor */
    opacity: 0;
    width: 0;
    height: 0;
}

/* ========================================================= */
/* RESPONSIVE DESIGN */
/* ========================================================= */
@media (max-width: 800px) {
    .hero { padding: 4rem 0 2rem; }
    .hero h1 { font-size: 2.2rem; }
    .top-hero h1 { font-size: 2.4rem; }
    .navbar { 
        padding: 1rem 0.8rem; 
        flex-direction: column;
        align-items: center;
        justify-content: center; 
        gap: 1rem; 
    }
    .logo, .logo a { font-size: 1.6rem; }
    .nav-links { 
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        width: 100%;
        max-width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem; 
        padding: 0.5rem; 
        justify-content: center;
        background: rgba(255, 255, 255, 0.03);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    }
    .nav-links a { display: inline-flex; } /* Restore links */
    .nav-links a, .nav-links button { 
        margin-left: 0; 
        font-size: 0.85rem; 
        padding: 0.4rem 0.8rem; 
        white-space: nowrap; 
    }
    
    /* Notification Dropdown Mobile Fix */
    #notificationDropdown {
        position: fixed !important;
        top: 140px !important; /* Display right below the mobile navbar */
        left: 0 !important;
        right: 0 !important;
        margin: 0 auto !important; /* Centers block without transform */
        width: 92vw !important;
        max-width: 380px !important;
        z-index: 10000;
    }
    
    .notification-container {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
}

@media (max-width: 480px) {
    .navbar { padding: 0.8rem 0.5rem; }
    .logo-main { font-size: 1.3rem; }
    .logo-sup { font-size: 0.5rem; }
}


/* ========================================================= */
/* ========================================================= */
/* PREMIUM — 1. NOISE / GRAIN TEXTURE OVERLAY                */
/* ========================================================= */
body::after {
    content: '';
    position: fixed;
    top: -50%; left: -50%; right: -50%; bottom: -50%;
    width: 200%; height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
    opacity: 0.028;
    z-index: 9998;
    pointer-events: none;
    animation: noiseShift 8s steps(2) infinite;
}

@keyframes noiseShift {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-3%, 2%); }
    50%  { transform: translate(2%, -3%); }
    75%  { transform: translate(-2%, -2%); }
    100% { transform: translate(3%, 3%); }
}

/* ========================================================= */
/* PREMIUM — 2. MAGNETIC BUTTONS (TRANSITION)               */
/* ========================================================= */
.btn-outline, .submit-btn, .search-btn, .clear-btn {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                background 0.3s ease,
                border-color 0.3s ease,
                color 0.3s ease,
                box-shadow 0.3s ease;
}

/* ========================================================= */
/* PREMIUM — 3. TEXT SCRAMBLE (JS ONLY)                     */
/* ========================================================= */

/* ========================================================= */
/* PREMIUM — 4. SPOTLIGHT SEARCH OVERLAY                    */
/* ========================================================= */
#searchOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    pointer-events: none;
    z-index: 90;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}

#searchOverlay.active {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    pointer-events: all;
}

/* Elevate main so search bar and results sit above the overlay */
body.search-active main {
    position: relative;
    z-index: 95;
}

/* Manually dim the hero and section headers to maintain spotlight effect */
body.search-active .hero h1,
body.search-active .hero p,
body.search-active .hero-actions,
body.search-active .section-header,
body.search-active .topic-hero h1,
body.search-active .topic-hero p,
body.search-active .topic-badge,
body.search-active #bookmarksSection {
    opacity: 0.1;
    filter: blur(8px);
    pointer-events: none;
    transform: translateY(-20px);
}

.hero h1, .hero p, .hero-actions, .section-header,
.topic-hero h1, .topic-hero p, .topic-badge, .filters, #bookmarksSection {
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), 
                filter 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
                height 0.4s ease,
                margin 0.4s ease;
}

/* SEARCH SWIPE-UP PHYSICS */
body.search-active .hero,
body.search-active .topic-hero {
    padding-top: 1.5rem;
    padding-bottom: 0px;
    transition: padding 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

body.search-active .categories-section {
    padding-top: 0.5rem;
}

body.search-active .filters {
    margin-bottom: 0.5rem;
    opacity: 1 !important;
    filter: none !important;
    pointer-events: all !important;
    transform: translateY(0) !important;
}

body.search-active .filter-category {
    opacity: 1 !important;
    filter: none !important;
    pointer-events: all !important;
    transform: translateY(0) !important;
}

body.search-active .discovery-filters-wrapper {
    margin-top: 0.5rem;
}

/* Pull up the Empty State when searching to reduce gap */
body.search-active .empty-state {
    padding-top: 0;
    margin-top: -1.5rem;
}

body.search-active .section-header {
    height: 0;
    margin: 0;
    overflow: hidden;
    opacity: 0;
}

.search-container {
    position: relative;
    z-index: 100;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.4s ease,
                margin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

body.search-active .search-container {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 20px var(--accent-alpha);
}

.search-container {
    position: relative;
    z-index: 95;
}

/* ========================================================= */
/* PREMIUM — 5. SCANLINES CRT OVERLAY                       */
/* ========================================================= */
#scanlines {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(0, 0, 0, 0.03) 3px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 9997;
    opacity: 1;
}

/* ========================================================= */
/* PREMIUM — 6. BFCACHE FIX (JS ONLY)                       */
/* ========================================================= */

/* ========================================================= */
/* FOOTER & THANK YOU NOTE                                   */
/* ========================================================= */
.footer {
    padding: 6rem 2rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.footer .line {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #60a5fa, #a855f7);
    margin: 0 auto 2.5rem;
    border-radius: 10px;
}

.thank-you-text {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.8rem;
    letter-spacing: -0.5px;
}

.footer-subtext {
    color: var(--text-secondary);
    font-size: 0.95rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .thank-you-text { font-size: 1.8rem; }
}



/* ========================================================= */
/* PREMIUM — 7. FLOATING COMMAND CENTER (CONTACT DOCK)      */
/* ========================================================= */
.command-center-wrapper {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 150px);
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    z-index: 999;
    pointer-events: none; /* Let clicks through orbs if necessary */
    display: flex;
    justify-content: center;
    width: 100%;
}

.command-center-wrapper.visible {
    transform: translate(-50%, 0);
    opacity: 1;
}

.command-dock {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem;
    background: rgba(24, 24, 27, 0.4);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.02);
    pointer-events: all;
}

.dock-item {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dock-icon {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.3s ease;
    filter: drop-shadow(0 0 0 transparent);
}

/* Hover States */
.dock-item:hover {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-8px) scale(1.15);
}

.dock-item:hover .dock-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 10px var(--accent));
}

/* Tooltip Labels */
.dock-label {
    position: absolute;
    bottom: 140%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(9, 9, 11, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.dock-item:hover .dock-label {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dock-separator {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0 4px;
}

/* Ensure the floating dock doesn't cover content at the very bottom */
body {
    padding-bottom: 8rem;
}

@media (max-width: 768px) {
    .command-center-wrapper {
        bottom: 1rem;
    }
    .command-dock {
        padding: 0.4rem;
        gap: 0.3rem;
    }
    .dock-item {
        width: 42px;
        height: 42px;
    }
    .dock-label {
        display: none; /* Hide tooltips on mobile */
    }
    body {
        padding-bottom: 6rem;
    }
}
/* ========================================================= */
/* PREMIUM — 8. GLOBAL PAGE TRANSITIONS & LOADER           */
/* ========================================================= */

/* Full-Screen Preloader (Cinematic Splash) */
#pageLoader {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1), 
                opacity 1s cubic-bezier(0.19, 1, 0.22, 1),
                filter 1s ease;
    overflow: hidden;
}

#pageLoader.loaded {
    transform: scale(1.2);
    opacity: 0;
    filter: blur(30px);
    pointer-events: none;
}

/* Drifting Loader Particles */
.loader-particle {
    position: absolute;
    background: var(--accent);
    filter: blur(5px);
    border-radius: 50%;
    opacity: 0.3;
    pointer-events: none;
}

.loader-logo {
    font-family: 'Inter', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: -2px;
    margin-bottom: 2rem;
    animation: loaderPulse 2.5s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.loader-logo .highlight {
    background: linear-gradient(135deg, var(--accent), #6ebaff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0;
    margin-left: 2px;
}

.loader-bar-container {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loader-bar {
    position: absolute;
    top: 0; left: 0; height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #60a5fa, var(--accent));
    animation: loaderFill 2.5s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes loaderPulse {
    0% { opacity: 0; transform: scale(0.95); filter: blur(10px); }
    100% { opacity: 1; transform: scale(1); filter: blur(0); }
}

@keyframes loaderFill {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* Page Content Reveal Animation */
.page-reveal {
    animation: pageReveal 1s cubic-bezier(0.23, 1, 0.32, 1) both;
}

@keyframes pageReveal {
    from { opacity: 0; transform: translateY(30px); filter: blur(10px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* Staggered entry for children */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }



/* ========================================================= */
/* PRODUCTION UI/UX OVERHAUL FINISHING DETAILS               */
/* ========================================================= */

/* 1. Global Themed Selection */
::selection {
    background: var(--topic-color, var(--accent));
    color: #fff;
    text-shadow: none;
}

/* 2. Custom Global Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    border: 2px solid var(--bg-dark);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--topic-color, var(--accent));
}

/* 3. Keyboard Navigation Outline */
*:focus-visible {
    outline: 2px solid var(--topic-color, var(--accent));
    outline-offset: 4px;
    box-shadow: 0 0 15px var(--topic-color, var(--accent));
}

/* Remove square focus box from search input which is inside a round container */
#searchInput:focus-visible {
    outline: none !important;
}

/* 4. Global Toast System */
#toastContainer {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}
.premium-toast {
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--topic-color, var(--accent));
    color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 15px rgba(255,255,255,0.05);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    opacity: 0;
    transform: translateX(100%);
    animation: toastSlideIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
.premium-toast.exit {
    animation: toastSlideOut 0.4s ease forwards;
}
@keyframes toastSlideIn {
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toastSlideOut {
    to { opacity: 0; transform: translateX(100%); }
}

/* 5. Custom Tooltip */
.custom-tooltip-element {
    position: absolute;
    background: rgba(9, 9, 11, 0.98);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: var(--font-heading);
    font-weight: 600;
    pointer-events: none;
    z-index: 100000;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
}
.custom-tooltip-element.visible {
    opacity: 1;
    transform: translateY(0);
}

/* 6. Card Badges */
.card-badge {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 0.8rem;
    background: var(--topic-color-alpha, rgba(255,255,255,0.1));
    color: var(--card-color, var(--text-primary));
    border: 1px solid var(--card-color, rgba(255,255,255,0.2));
    box-shadow: 0 0 10px var(--topic-color-alpha, transparent);
}

/* 7. Empty State Illustration */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-secondary);
    background: rgba(24, 24, 27, 0.3);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}
.empty-state svg {
    margin-bottom: 1.5rem;
    opacity: 0.8;
    filter: drop-shadow(0 0 25px var(--topic-color, var(--accent)));
    color: var(--topic-color, var(--accent));
}
.empty-state h3 {
    font-family: var(--font-heading);
    color: #fff;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* 8. Skeletons */
.skeleton-card {
    background: rgba(24, 24, 27, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 2rem;
    height: 380px;
    position: relative;
    overflow: hidden;
}
.skeleton-card::before {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    animation: skeletonShimmer 1.5s infinite;
}
@keyframes skeletonShimmer {
    100% { transform: translateX(100%); }
}

/* 9. Spotlight Border (Vanilla Tilt + Spotlight) */
.category-card::after, .resource-card::after {
    content: "";
    position: absolute;
    inset: 0;
    /* Uses CSS variables updated by JS */
    background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.06), transparent 40%);
    border-radius: inherit;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
}
.category-card:hover::after, .resource-card:hover::after {
    opacity: 1;
}




/* --- USER UTILITY UI --- */
.card-actions {
    position: absolute;
    bottom: 1.8rem;
    right: 1.8rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.bookmark-btn, .progress-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(8px);
}

.bookmark-btn:hover, .progress-toggle:hover {
    transform: translateY(-2px);
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.bookmark-btn.active {
    background: #22c55e;
    color: #fff;
    border-color: #4ade80;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.progress-toggle.completed {
    background: #22c55e;
    color: #fff;
    border-color: #4ade80;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.category-card, .resource-card {
    position: relative;
}

.topic-page .bookmark-btn.active {
    background: var(--topic-color);
    border-color: var(--topic-color);
}

.topic-progress-container #progressBar {
    box-shadow: 0 0 15px var(--topic-color-alpha);
}

/* --- DISCOVERY FILTERS (ADVANCED SEARCH) --- */
.discovery-filters-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 3rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1.5rem 2rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.filter-category {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1;
    min-width: 250px;
}

.filter-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-secondary);
    font-weight: 700;
    opacity: 0.6;
}

.level-filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.level-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--topic-color, var(--accent));
}

.level-filter-btn.active {
    background: var(--topic-color, var(--accent));
    color: #fff;
    border-color: var(--topic-color, var(--accent));
    box-shadow: 0 4px 15px var(--topic-color-alpha);
}

/* --- RESOURCE TAGS --- */
.resource-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 1rem 0 1.5rem;
}

.tag-pill {
    font-size: 0.65rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 600;
    transition: all 0.3s ease;
}

.resource-card:hover .tag-pill {
    border-color: var(--topic-color-alpha);
    color: #fff;
}



/* --- RELATED TOPICS ROW (DISCOVERY) --- */
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.related-card {
    background: rgba(24, 24, 27, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    border-radius: 20px;
    text-decoration: none;
    color: white;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.related-card:hover {
    border-color: var(--cat-color);
    background: rgba(39, 39, 42, 0.8);
    box-shadow: 0 10px 30px -15px var(--cat-color);
    transform: translateY(-4px);
}

.related-icon-mini {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--cat-color, var(--accent));
    transition: all 0.4s ease;
}

.related-icon-mini svg {
    width: 28px;
    height: 28px;
    display: block;
}

.related-card:hover .related-icon-mini {
    background: var(--cat-color, var(--accent));
    color: #fff;
    transform: rotate(-10deg) scale(1.1);
}

.related-info h4 {
    margin: 0 0 0.25rem;
    font-family: var(--font-heading);
    color: #fff;
    font-size: 1.1rem;
}

.related-info p {
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

@media (max-width: 768px) {
    .discovery-filters-wrapper { padding: 1rem; gap: 1.5rem; }
}

/* --- COMMUNITY MODAL (ENGAGEMENT) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.community-modal {
    background: rgba(15, 15, 20, 0.85); 
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 800px;
    width: 100%;
    border-radius: 28px;
    padding: 3rem;
    position: relative;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    transform: translateY(20px);
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.active .community-modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.4);
    transform: rotate(90deg);
}

.community-header {
    text-align: center;
    margin-bottom: 3rem;
}

.community-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

.community-badge {
    background: var(--topic-color-alpha, rgba(184, 155, 252, 0.1));
    color: var(--topic-color, var(--accent));
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    display: inline-block;
    border: 1px solid var(--topic-color-alpha, rgba(184, 155, 252, 0.2));
}

.community-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.community-section {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2.5rem 2rem;
    border-radius: 24px;
    text-align: center;
    transition: all 0.4s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.community-section:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-color: rgba(184, 155, 252, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(184, 155, 252, 0.1);
}

.community-section h3 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
    color: #fff;
}

.community-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

/* Glowing Icon Styles */
.section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin: 0 auto 1.5rem auto;
    transition: all 0.4s ease;
}

.community-section:hover .section-icon {
    background: rgba(184, 155, 252, 0.08);
    border-color: rgba(184, 155, 252, 0.3);
    transform: scale(1.1);
}

.section-icon svg {
    transition: all 0.4s ease;
    filter: drop-shadow(0 0 8px currentColor);
}

.section-icon.rocket svg {
    color: var(--accent);
}

.section-icon.star svg {
    color: #fbbf24;
}

.community-section:hover .section-icon.rocket svg {
    filter: drop-shadow(0 0 12px var(--accent));
}

.community-section:hover .section-icon.star svg {
    filter: drop-shadow(0 0 12px #fbbf24);
}

.community-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: var(--accent);
    color: #000;
    padding: 0.8rem 1.8rem;
    border-radius: 12px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.community-action.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.community-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(184, 155, 252, 0.4);
}

.community-action.secondary:hover {
    background: rgba(251, 191, 36, 0.1);
    border-color: #fbbf24;
    color: #fbbf24;
    box-shadow: 0 10px 25px rgba(251, 191, 36, 0.3);
}

.rating-stars {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem 0;
}

.rating-stars span {
    font-size: 2.2rem;
    color: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

.rating-stars span.active,
.rating-stars span:hover {
    color: #fbbf24;
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
    transform: scale(1.15);
}

.community-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.social-tags {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.5;
}

.social-tags span {
    transition: all 0.3s ease;
    cursor: pointer;
}

.social-tags span:hover {
    color: var(--accent);
    opacity: 1;
}

/* --- CURSOR RESTORE --- */
body, a, button, input, select, textarea, .category-card, .resource-card, .submit-btn, .search-btn, .dock-item {
    cursor: auto !important;
}

/* ========================================================= */
/* TOPIC STICKY NAV & MASTERY BAR */
/* ========================================================= */
.topic-sticky-nav {
    position: sticky;
    top: 0;
    width: 100%;
    height: 80px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    padding: 0 !important;
}

.topic-sticky-nav .nav-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
    height: 100%;
}

.mastery-container {
    flex: 1;
    max-width: 500px;
}

.mastery-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 6px;
}

.mastery-label {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.mastery-percent {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--topic-color);
    text-shadow: 0 0 15px var(--topic-color-alpha);
}

.mastery-bar-outer {
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.02);
}

.mastery-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, transparent, var(--topic-color));
    border-radius: 20px;
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 0 15px var(--topic-color-alpha);
}

.nav-icon-link {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.nav-icon-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: var(--topic-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
}

@media (max-width: 850px) {
    .mastery-container { display: none; }
}

/* ========================================================= */
/* TRIBUTE SECTION (Special Thanks) */
/* ========================================================= */
.tribute-section {
    margin-top: 5rem;
    padding-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.tribute-badge {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.85rem;
    font-family: var(--font-heading);
}

.tribute-badge svg {
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent));
    animation: heartPulse 2s infinite ease-in-out;
}

.tribute-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 3rem;
    border-radius: 24px;
    max-width: 800px;
    width: 100%;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.tribute-card::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(184, 155, 252, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.tribute-card p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
}

.tribute-card p strong {
    color: var(--text-primary);
    border-bottom: 1px dashed var(--accent);
}

.tribute-quote {
    font-size: 1.4rem;
    font-family: var(--font-heading);
    color: #fff;
    font-style: italic;
    font-weight: 600;
    text-shadow: 0 0 20px rgba(184, 155, 252, 0.3);
}

@keyframes heartPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

@media (max-width: 768px) {
    .tribute-card { padding: 2.5rem 1.5rem; }
    .tribute-quote { font-size: 1.1rem; }
}

/* ========================================================= */
/* ETHOS & POLICY SECTIONS */
/* ========================================================= */
.ethos-section {
    margin-top: 4rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

.policy-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 3rem;
    border-radius: 20px;
}

.policy-card h3 {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.policy-card p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
}

.policy-card.disclaimer {
    border-left: 4px solid var(--accent);
    background: rgba(184, 155, 252, 0.03);
}

.policy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.policy-item strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.policy-item p {
    font-size: 0.95rem;
    opacity: 0.8;
}

.remove-notice {
    font-size: 0.9rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
    .policy-card { padding: 2rem 1.5rem; }
    .policy-grid { grid-template-columns: 1fr; }
}

/* Community Modal Responsive Fixes */
@media (max-width: 600px) {
    .community-modal {
        padding: 3.5rem 1.25rem 2.5rem 1.25rem;
        border-radius: 20px;
        margin: 0 10px;
        width: calc(100% - 20px);
    }
    
    .community-header {
        margin-bottom: 2.2rem;
    }
    
    .community-badge {
        margin-bottom: 1.2rem;
    }
    
    .community-header h2 {
        font-size: 1.65rem;
        line-height: 1.35;
    }
    
    .community-header p {
        font-size: 0.95rem;
        line-height: 1.6;
        padding: 0 0.5rem;
    }
    
    .community-grid {
        gap: 1.5rem;
        grid-template-columns: 1fr;
    }
    
    .community-section {
        padding: 1.8rem 1.2rem;
        border-radius: 18px;
    }
    
    .section-icon {
        width: 54px;
        height: 54px;
        margin-bottom: 1.2rem;
    }
    
    .section-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .community-section h3 {
        font-size: 1.25rem;
    }
    
    .community-action {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }
    
    .rating-stars {
        margin: 1.2rem 0;
        gap: 0.4rem;
    }
    
    .rating-stars span {
        font-size: 1.8rem;
    }
    
    .community-footer {
        margin-top: 1.8rem;
        padding-top: 1.5rem;
    }
    
    .social-tags {
        gap: 0.8rem;
        font-size: 0.75rem;
        flex-wrap: wrap;
    }

    /* Modal Overlay Scrollability */
    .modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
        padding: 1.5rem 0.5rem;
    }
}

/* Custom UI Polish & Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 3px solid var(--bg-dark);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Accessibility: Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .background-effects, .loader-particle {
        display: none !important;
    }
    .category-card {
        transform: translateY(0) !important;
        opacity: 1 !important; /* Start visible */
    }
    html {
        scroll-behavior: auto !important;
    }
}
