@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Vibrant Palette */
    --primary: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --secondary-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --accent: #f43f5e;

    --background: #f1f5f9;
    --surface: #ffffff;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-glow: 0 10px 25px -5px rgba(79, 70, 229, 0.15), 0 8px 10px -6px rgba(79, 70, 229, 0.1);

    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --font-sans: 'Inter', sans-serif;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    /* Subtle background mesh/gradient */
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    margin: 0;
    padding-top: 80px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 72px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.03);
}

.header-inner {
    width: 100%;
    max-width: 1400px;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 22px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.nav-btn {
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 50px;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.nav-btn:hover {
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    color: var(--primary);
}

.nav-btn.primary {
    background: var(--text-main);
    color: white;
}

.nav-btn.primary:hover {
    background: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

/* --- Container --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 30px;
}

/* --- Controls Bar --- */
.controls-bar {
    display: flex;
    
    align-items: center;
    margin-bottom: 35px;
    flex-wrap: wrap;
    gap: 15px;
    background: white;
    padding: 15px 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-soft);
}

.search-form {
    display: flex;
    flex-grow: 1;
  
    gap: 12px;
}

.input-styled {
    padding: 12px 18px;
    border: 2px solid #f1f5f9;
    border-radius: var(--radius-sm);
    outline: none;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    background: #f8fafc;
}

.input-styled:focus {
    border-color: #cbd5e1;
    background: white;
}

.btn-icon {
    background: var(--text-main);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0 24px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--primary);
    transform: translateY(-1px);
}

/* --- Grid & Cards --- */
.grid {
    display: grid;
    /* 3 boxes per line request */
    grid-template-columns: repeat(3, 1fr);
    gap: 35px;
}

@media (max-width: 1024px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    }
}

.card {
    background: var(--surface);
    border-radius: 24px;
    /* Rounder */
    box-shadow: var(--shadow-soft);
    border: 1px solid transparent;
    overflow: hidden;
    position: relative;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Bouncy spring */
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-10px) scale(1.01);
    box-shadow: var(--shadow-glow);
    border-color: rgba(99, 102, 241, 0.1);
    /* Subtle border color on hover */
}

.card-image {
    position: relative;
    height: 250px;
    background: #e2e8f0;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.card:hover .card-image img {
    transform: scale(1.12);
}

.badge-fav {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 18px;
    color: #94a3b8;
    z-index: 5;
}

.badge-fav:hover {
    transform: scale(1.15) rotate(5deg);
    background: white;
    color: var(--accent);
}

.badge-fav.active {
    color: var(--accent);
    background: #fff1f2;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}

/* --- Card Content --- */
.card-content {
    padding: 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    line-height: 1.35;
    letter-spacing: -0.03em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
    background: linear-gradient(to right, #1e293b, #1e293b);
    background-size: 0% 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s, color 0.3s;
}

.card:hover .card-title a {
    color: #4f46e5;
}

.copy-icon {
    font-size: 16px;
    color: #cbd5e1;
    cursor: pointer;
    padding: 5px;
    transition: all 0.2s;
}

.copy-icon:hover {
    color: var(--primary);
    transform: scale(1.1);
}

/* --- Stats Grid --- */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-item {
    background: #f8fafc;
    padding: 14px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.stat-item:hover {
    background: white;
    border-color: #e2e8f0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.stat-item.dark {
    background: var(--text-main);
    color: white;
}

.stat-item.dark:hover {
    background: #0f172a;
    /* Slightly darker */
}

.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    opacity: 0.7;
}

/* --- Details Grid --- */
.details-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
}

.detail-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    background: #f1f5f9;
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 5px;
}

.detail-badge.premium {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
    color: #78350f;
    border: none;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.detail-badge i {
    font-size: 10px;
    opacity: 0.7;
}

/* --- Meta Info --- */
.meta-row {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

.meta-row i {
    margin-right: 8px;
    color: #94a3b8;
}

.contributor-box {
    background: #f8fafc;
    padding: 10px 14px;
    border-radius: 50px;
    /* Fully pill shaped */
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.contributor-box:hover {
    background: white;
    border-color: #e2e8f0;
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* --- Keywords --- */
.keywords-area {
    margin-top: 5px;
}

.kw-header {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kw-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 28px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.kw-list.expanded {
    max-height: 400px;
}

.kw-pill {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    background: white;
    border: 1px solid #e2e8f0;
    padding: 5px 12px;
    border-radius: 20px;
    transition: all 0.2s;
}

.kw-pill:hover {
    border-color: #6366f1;
    color: #4338ca;
    background: #eef2ff;
    transform: translateY(-1px);
}

.kw-toggle {
    font-size: 12px;
    font-weight: 700;
    color: #6366f1;
    cursor: pointer;
    display: inline-block;
    margin-top: 10px;
    transition: color 0.2s;
}

.kw-toggle:hover {
    color: #4f46e5;
}

/* --- Pagination --- */
.pagination {
    margin-top: 70px;
    margin-bottom: 50px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.pagination a {
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 700;
    font-size: 15px;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
}

.pagination a:hover {
    border-color: #6366f1;
    color: #6366f1;
    transform: translateY(-2px);
}

.pagination a.active {
    background: var(--text-main);
    color: white;
    border-color: var(--text-main);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
}