/* Google Fonts loaded via <link> in <head> for non-blocking render */

:root {
    --bg-color: #0d1228;
    --primary: #5b6ef5;
    --primary-glow: rgba(91, 110, 245, 0.5);
    --secondary: #3b82f6;
    --accent: #60a5fa;
    --text-main: #ffffff;
    --text-muted: #c8cdd8;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Mesh Gradient */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: 
        radial-gradient(circle at 20% 30%, rgba(110, 122, 255, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(91, 110, 245, 0.15) 0%, transparent 40%);
    filter: blur(100px);
    transform: translateZ(0); /* Force GPU acceleration */
    will-change: transform;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header & Typography */
h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.header {
    text-align: center;
    padding: 6rem 0 4rem;
    position: relative;
}

.header::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    background: var(--primary);
    filter: blur(140px);
    opacity: 0.2;
    z-index: -1;
}

.header h1 {
    font-size: 5rem;
    background: linear-gradient(135deg, #ffffff 0%, #e0e8ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.04em;
    font-weight: 800;
}

.header p {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 2rem;
    font-weight: 400;
}

.header-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.logo-area {
    display: inline-block;
    position: relative;
}

.header-divider {
    height: 1px;
    width: 80px;
    background: linear-gradient(to right, transparent, var(--primary), transparent);
    margin: 1rem auto 2rem;
}

.badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.4rem 1rem;
    border-radius: 100px;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

/* Link Tree Card Style */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 3rem;
}

.card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, var(--primary-glow), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s;
}

.card:hover::before {
    opacity: 0.3;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: all 0.3s;
}

.card:hover .badge {
    border-color: var(--primary);
    color: #fff;
}

/* Detail Page Specifics */
.detail-container {
    max-width: 800px;
    margin: 4rem auto;
}

.detail-article {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3rem;
}

.detail-article h2 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.detail-article p {
    margin-bottom: 1.5rem;
    line-height: 1.8;
}

/* Sections Grid */
.sections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 3rem 2rem;
    margin-top: 2rem;
}

/* Categorized Sections */
.cat-section {
    animation: fadeIn 0.8s ease-out forwards;
}

.cat-header {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
    width: 100%;
    opacity: 0.8;
}

.cat-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.02em;
}

.cat-header-link {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

.cat-header-link:hover {
    color: #fff;
}

.header-meta {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

.status-badge {
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: 4px;
    font-weight: 700;
    vertical-align: middle;
    flex-shrink: 0; /* Never shrink the badge out of view */
}

.status-badge.new {
    background: var(--primary);
    color: white;
}

.status-badge.hot {
    background: transparent;
    padding: 0;
    font-size: 1rem;
    filter: drop-shadow(0 0 4px rgba(255, 71, 87, 0.6));
    display: inline-block;
}

/* Compact Grid for high density */
.compact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.cat-scroll {
    max-height: 280px;
    overflow-y: auto;
    padding-right: 6px;
    padding-bottom: 1rem;
}

.cat-scroll::-webkit-scrollbar {
    width: 4px;
}

.cat-scroll::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}

.cat-scroll::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.pill {
    background: rgba(255, 255, 255, 0.09); /* Solid transparent background instead of expensive blur */
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s ease-out;
    position: relative;
    overflow: hidden;
    will-change: transform, background, border-color; /* Optimization for hover effects */
}

.pill-rank {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    min-width: 14px;
    opacity: 0.5;
}



.pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.pill-logo {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 1px;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.pill:hover .pill-logo {
    transform: scale(1.15);
}

.pill-info {
    display: flex;
    flex-direction: column;
    overflow: visible;
    flex: 1;
    min-width: 0;
}

.pill-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    color: #ffffff;
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 4px;
    overflow: visible;
}

.pill-text {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    overflow: visible;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
}

.pill-cat {
    display: none; /* Hide category inside pill as it's already in the header */
}

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

.fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    will-change: opacity, transform;
}

/* Responsive */
/* ── Mobile (≤ 600px) ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .container { padding: .75rem; }

    /* Hero */
    .header { padding: 3rem 0 2rem; }
    .header p { font-size: .95rem; padding: 0 .5rem; }
    .header-meta { flex-wrap: wrap; gap: .5rem; }

    /* Nav — collapse to horizontal scroll strip */
    .top-nav { padding: .75rem 0; }
    .nav-links {
        gap: 1rem;
        padding: .45rem 1rem;
        font-size: .8rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }
    .nav-links::-webkit-scrollbar { display: none; }

    /* Category jump pills — already scroll, just tighten */
    .category-pills { margin-top: 1rem; gap: .35rem; }
    .cat-pill { padding: .25rem .7rem; font-size: .75rem; }

    /* Search */
    .search-wrapper { margin-bottom: 1.5rem; }
    #siteSearch { padding: .75rem 1.1rem; font-size: .9rem; }

    /* Sections grid → single column */
    .sections-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Compact pill grid → 2 columns on mobile */
    .compact-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: .4rem;
    }

    /* Pills — tighter on small screens */
    .pill { padding: .4rem .5rem; gap: .35rem; }
    .pill-name { font-size: .78rem; }
    .pill-rank { display: none; }          /* hide rank number — saves space */
    .pill-detail-link { width: 20px; font-size: .8rem; }

    /* Scrollable section max-height — shorter on phones */
    .cat-scroll { max-height: 220px; }

    /* Footer */
    .footer { margin-top: 4rem; padding-top: 2rem; padding-bottom: 2rem; }
    .footer-links { flex-wrap: wrap; gap: 1rem; justify-content: center; }
    .footer-cats { gap: .3rem .5rem; margin-bottom: 1.5rem; }
    .scroll-top { bottom: 1rem; right: 1rem; width: 38px; height: 38px; font-size: 1rem; }
}

/* ── Tablet (601px – 768px) ─────────────────────────────────────────────── */
@media (min-width: 601px) and (max-width: 768px) {
    .container { padding: 1rem; }
    .header { padding: 4rem 0 2.5rem; }
    .sections-grid { grid-template-columns: 1fr; gap: 2rem; }
    .compact-grid { grid-template-columns: repeat(2, 1fr); }
    .nav-links { gap: 1.25rem; }
}

/* Navigation */
.top-nav {
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

.nav-links {
    display: flex;
    gap: 2rem;
    background: rgba(255, 255, 255, 0.07);
    padding: 0.6rem 1.5rem;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.14);
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: white;
}

/* Footer */
.footer {
    margin-top: 8rem;
    text-align: center;
    padding-bottom: 4rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 4rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer p {
    color: #444;
    font-size: 0.8rem;
}

/* Footer category links */
.footer-cats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .4rem .6rem;
    margin-bottom: 2rem;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.footer-cat-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: .78rem;
    opacity: .65;
    transition: opacity .2s, color .2s;
    white-space: nowrap;
}

.footer-cat-link:hover {
    color: #fff;
    opacity: 1;
}

/* Scroll to top button */
.scroll-top {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(91, 110, 245, 0.45);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    z-index: 999;
}

.scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.scroll-top:hover {
    background: var(--secondary);
    transform: translateY(-2px);
}

/* ── Hero rework ────────────────────────────────────────────────────────── */
.header h1 {
    font-size: clamp(2rem, 5vw, 3.8rem);
    background: linear-gradient(135deg, #ffffff 0%, #e0e8ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
    font-weight: 800;
    line-height: 1.15;
}

.header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 560px;
    margin: 0 auto 1.5rem;
}

.header p strong {
    color: #fff;
    -webkit-text-fill-color: #fff;
}

/* Category quick-jump pills */
.category-pills {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    gap: .45rem;
    margin-top: 1.75rem;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
    padding: .4rem .25rem .7rem;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.category-pills::-webkit-scrollbar { display: none; }

.cat-pill {
    padding: .3rem .85rem;
    border-radius: 99px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.1);
    font-size: .78rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: background .25s ease, border-color .25s ease, color .25s ease, box-shadow .25s ease;
    white-space: nowrap;
}

.cat-pill:hover {
    background: rgba(91,110,245,.2);
    border-color: var(--primary);
    color: #fff;
}

.cat-pill-more {
    cursor: default;
    opacity: .5;
}

.cat-section {
    scroll-margin-top: 80px;
}

/* ── Search Bar ─────────────────────────────────────────────────────────── */
.search-wrapper {
    max-width: 600px;
    margin: 0 auto 3rem;
    position: relative;
}

#siteSearch {
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    color: var(--text-main);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

#siteSearch::placeholder {
    color: var(--text-muted);
}

#siteSearch:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* ── Pill Wrapper (pill + detail arrow) ─────────────────────────────────── */
.pill-wrapper {
    position: relative;
    display: flex;
    align-items: stretch;
}

.pill-wrapper .pill {
    flex: 1;
    border-radius: 12px 0 0 12px;
    border-right: none;
}

.pill-detail-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-left: none;
    border-radius: 0 12px 12px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.pill-wrapper:hover .pill-detail-link {
    background: rgba(91, 110, 245, 0.15);
    color: var(--primary);
}

/* When search is active, hide entire wrapper cleanly */
.pill-wrapper[style*="display: none"] {
    display: none !important;
}
