/* ============================================================
   Q4KM.ai Model Directory — "Terminal Luxe" Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* --- Design Tokens --- */
:root {
    /* Core palette */
    --ink: #0a0a0f;
    --ink-soft: #1a1a2e;
    --slate: #6b7280;
    --slate-light: #9ca3af;
    --ash: #d1d5db;
    --fog: #e5e7eb;
    --cloud: #f3f4f6;
    --paper: #f9fafb;
    --white: #ffffff;

    /* Brand gradient */
    --grad-start: #667eea;
    --grad-mid: #6c5ce7;
    --grad-end: #764ba2;

    /* Accents */
    --accent-blue: #2563eb;
    --accent-green: #10b981;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;

    /* Typography */
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --font-body: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    --shadow-glow: 0 0 20px rgba(102,126,234,0.15);

    /* Radii */
    --r-sm: 0.375rem;
    --r-md: 0.5rem;
    --r-lg: 0.75rem;
    --r-xl: 1rem;
    --r-2xl: 1.25rem;
    --r-full: 9999px;

    /* Layout */
    --max-w: 1320px;
    --max-w-content: 900px;
    --sidebar-w: 240px;
    --card-min: 300px;
    --gap: 1.25rem;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover { color: var(--grad-start); }

img { max-width: 100%; height: auto; }

/* --- Utility --- */
.container {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: 0 1.5rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ============================================================
   HEADER & ASCII BANNER
   ============================================================ */
.site-header {
    background: linear-gradient(145deg, var(--ink) 0%, var(--ink-soft) 60%, #16213e 100%);
    padding: 1.5rem 0 0;
    position: relative;
    overflow: hidden;
}

/* Subtle grid overlay on header */
.site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(102,126,234,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102,126,234,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.ascii-banner {
    font-family: var(--font-mono);
    font-size: clamp(0.35rem, 1.2vw, 0.65rem);
    line-height: 1.15;
    white-space: pre;
    text-align: center;
    font-weight: 700;
    padding: 1rem 0 0.75rem;
    background: linear-gradient(135deg, var(--grad-start) 0%, var(--accent-cyan) 50%, var(--grad-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent;
    user-select: none;
    position: relative;
    z-index: 1;
}

/* --- Navigation --- */
.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0 1rem;
    position: relative;
    z-index: 1;
}

.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
}
.nav-logo span {
    background: linear-gradient(135deg, var(--grad-start), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 1.75rem;
    align-items: center;
    list-style: none;
}

.nav-links a {
    color: var(--slate-light);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}
.nav-links a:hover {
    color: var(--white);
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--grad-start), var(--grad-end));
    transition: width 0.2s ease;
    border-radius: 1px;
}
.nav-links a:hover::after { width: 100%; }

.nav-cta {
    background: linear-gradient(135deg, var(--accent-amber), #d97706);
    color: var(--ink) !important;
    padding: 0.4rem 1rem;
    border-radius: var(--r-full);
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nav-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245,158,11,0.3);
    color: var(--ink) !important;
}
.nav-cta::after { display: none; }

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
    background: linear-gradient(145deg, rgba(15,23,42,0.7) 0%, rgba(30,41,59,0.6) 40%, rgba(22,33,62,0.7) 100%), url('/images/header-bg.jpg') center/cover no-repeat;
    padding: 2rem 0 3rem;
    text-align: center;
    position: relative;
}

/* Radial glow behind hero */
.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(102,126,234,0.08) 0%, transparent 70%);
    pointer-events: none;
}

.hero h1 {
    font-family: var(--font-body);
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: 700;
    color: var(--white);
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    position: relative;
}

.hero p {
    color: var(--slate-light);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.hero-search {
    max-width: 560px;
    margin: 0 auto;
    position: relative;
}

.hero-search input {
    width: 100%;
    padding: 0.9rem 1.25rem 0.9rem 3rem;
    font-family: var(--font-body);
    font-size: 1rem;
    border: 2px solid rgba(102,126,234,0.2);
    border-radius: var(--r-xl);
    background: rgba(255,255,255,0.05);
    color: var(--white);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.hero-search input::placeholder {
    color: var(--slate);
}
.hero-search input:focus {
    border-color: var(--grad-start);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.15);
    background: rgba(255,255,255,0.08);
}

/* Search icon (CSS-only magnifying glass) */
.hero-search::before {
    content: '';
    position: absolute;
    left: 1.1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--slate);
    border-radius: 50%;
    z-index: 1;
}
.hero-search::after {
    content: '';
    position: absolute;
    left: 2.2rem;
    top: 58%;
    width: 2px;
    height: 7px;
    background: var(--slate);
    transform: rotate(-45deg);
    z-index: 1;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.75rem;
    flex-wrap: wrap;
}

.hero-stat {
    text-align: center;
}
.hero-stat-num {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
}
.hero-stat-label {
    font-size: 0.8rem;
    color: var(--slate);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ============================================================
   FILTER PANEL
   ============================================================ */
.filters {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--fog);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-xs);
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.filter-row:last-child { margin-bottom: 0; }

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--slate);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-width: 80px;
    flex-shrink: 0;
}

.filter-pills {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--slate);
    background: var(--cloud);
    border: 1px solid var(--fog);
    border-radius: var(--r-full);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    white-space: nowrap;
}
.filter-pill:hover {
    background: var(--fog);
    color: var(--ink);
    border-color: var(--ash);
}
.filter-pill.active {
    background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
    color: var(--white);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(102,126,234,0.25);
}

.filter-pill-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    opacity: 0.7;
}

.filter-more {
    color: var(--accent-blue);
    font-size: 0.82rem;
    cursor: pointer;
    font-weight: 500;
    border: none;
    background: none;
    padding: 0.3rem 0.5rem;
}
.filter-more:hover { text-decoration: underline; }

/* Mobile filter toggle */
.filter-toggle {
    display: none;
    width: 100%;
    padding: 0.65rem 1rem;
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--slate);
    background: var(--cloud);
    border: 1px solid var(--fog);
    border-radius: var(--r-lg);
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
}
.filter-toggle svg {
    transition: transform 0.2s ease;
}
.filter-toggle.open svg {
    transform: rotate(180deg);
}
.filter-toggle .filter-active-count {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
    color: var(--white);
    padding: 0.1rem 0.5rem;
    border-radius: var(--r-full);
    margin-left: 0.5rem;
}

/* Sort & Results bar */
.results-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.results-count {
    font-size: 0.9rem;
    color: var(--slate);
}
.results-count strong {
    color: var(--ink);
    font-weight: 600;
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sort-select {
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    border: 1px solid var(--fog);
    border-radius: var(--r-md);
    background: var(--white);
    color: var(--ink);
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%236b7280'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
}

.clear-filters {
    font-size: 0.82rem;
    color: var(--accent-red);
    cursor: pointer;
    font-weight: 500;
    border: none;
    background: none;
    padding: 0.3rem 0.5rem;
    display: none;
}
.clear-filters.visible { display: inline-block; }
.clear-filters:hover { text-decoration: underline; }

/* ============================================================
   MODEL CARD GRID
   ============================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-min), 1fr));
    gap: var(--gap);
    padding: 1.5rem 0 2rem;
}

.model-card {
    background: var(--white);
    border: 1px solid var(--fog);
    border-radius: var(--r-lg);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}
.model-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--ash);
    color: inherit;
}

/* Subtle top gradient accent on hover */
.model-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--grad-start), var(--grad-end));
    opacity: 0;
    transition: opacity 0.2s ease;
}
.model-card:hover::before { opacity: 1; }

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

.author-badge {
    width: 36px;
    height: 36px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--white);
    flex-shrink: 0;
    text-transform: uppercase;
}

.author-logo {
    width: 56px;
    height: 56px;
    border-radius: var(--r-md);
    object-fit: contain;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid #e9ecef;
    padding: 0;
}

.card-pipeline {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent-blue);
    background: rgba(37,99,235,0.08);
    padding: 0.2rem 0.55rem;
    border-radius: var(--r-full);
    white-space: nowrap;
}

.card-title {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
    letter-spacing: -0.01em;
    word-break: break-word;
}

.card-author {
    font-size: 0.82rem;
    color: var(--slate);
    font-weight: 500;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--slate);
    line-height: 1.5;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.6rem;
    border-top: 1px solid var(--cloud);
    margin-top: auto;
}

.card-downloads {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-green);
}

/* Download arrow icon (CSS) */
.card-downloads::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-bottom: 2px solid var(--accent-green);
    border-right: 2px solid var(--accent-green);
    transform: rotate(45deg);
    margin-bottom: 3px;
}

.card-license {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--slate);
    background: var(--cloud);
    padding: 0.15rem 0.5rem;
    border-radius: var(--r-full);
}

.card-frameworks {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.25rem;
}

.card-fw-pill {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--slate);
    background: var(--cloud);
    padding: 0.1rem 0.4rem;
    border-radius: var(--r-sm);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.card-featured {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 20px;
    height: 20px;
    color: var(--accent-amber);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    padding: 2rem 0 1rem;
}

.page-btn {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--fog);
    border-radius: var(--r-md);
    background: var(--white);
    color: var(--slate);
    cursor: pointer;
    transition: all 0.15s ease;
    min-width: 38px;
    text-align: center;
}
.page-btn:hover {
    background: var(--cloud);
    border-color: var(--ash);
    color: var(--ink);
}
.page-btn.active {
    background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
    color: var(--white);
    border-color: transparent;
}
.page-btn.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}
.page-ellipsis {
    font-family: var(--font-mono);
    color: var(--slate-light);
    padding: 0 0.25rem;
}

/* ============================================================
   CTA BANNER
   ============================================================ */
.cta-banner {
    background: linear-gradient(135deg, #92400e 0%, var(--accent-amber) 50%, #d97706 100%);
    border-radius: var(--r-xl);
    padding: 2.5rem 2rem;
    text-align: center;
    margin: 2rem 0;
    position: relative;
    overflow: hidden;
}

/* Texture overlay */
.cta-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.cta-banner h2 {
    color: var(--white);
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    position: relative;
}

.cta-banner p {
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.75rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--white);
    border: none;
    border-radius: var(--r-full);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    position: relative;
}
.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    color: var(--ink);
}

/* ============================================================
   MODEL DETAIL PAGE — BREADCRUMB
   ============================================================ */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.85rem;
    color: var(--slate);
}
.breadcrumb a {
    color: var(--slate);
    font-weight: 500;
}
.breadcrumb a:hover { color: var(--accent-blue); }
.breadcrumb-sep {
    margin: 0 0.5rem;
    color: var(--ash);
}

/* ============================================================
   MODEL DETAIL PAGE — HERO
   ============================================================ */
.detail-hero {
    background: linear-gradient(145deg, var(--ink) 0%, var(--ink-soft) 60%, #16213e 100%);
    padding: 2rem 0 2.5rem;
    position: relative;
}
.detail-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(102,126,234,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(102,126,234,0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.detail-hero-inner {
    position: relative;
    z-index: 1;
}

.detail-hero h1 {
    font-family: var(--font-mono);
    font-size: clamp(1.5rem, 3.5vw, 2.25rem);
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    word-break: break-word;
}

.detail-tagline {
    font-size: 1.05rem;
    color: var(--slate-light);
    line-height: 1.6;
    max-width: 720px;
    margin-bottom: 1.25rem;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 500;
    border-radius: var(--r-full);
    white-space: nowrap;
}

.meta-pill--author {
    background: rgba(255,255,255,0.1);
    color: var(--white);
}
.meta-pill--downloads {
    background: rgba(16,185,129,0.15);
    color: var(--accent-green);
    font-family: var(--font-mono);
}
.meta-pill--license {
    background: rgba(139,92,246,0.15);
    color: var(--accent-purple);
}
.meta-pill--pipeline {
    background: rgba(37,99,235,0.15);
    color: #93c5fd;
}
.meta-pill--featured {
    background: rgba(245,158,11,0.15);
    color: var(--accent-amber);
    font-weight: 600;
}
.meta-pill--rank {
    background: rgba(6,182,212,0.15);
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

/* ============================================================
   TAG CLOUD
   ============================================================ */
.tag-cloud {
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--fog);
}

.tag-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}
.tag-group:last-child { margin-bottom: 0; }

.tag-group-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--slate);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    min-width: 72px;
}

.tag-pill {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: var(--r-full);
    border: 1px solid var(--fog);
    color: var(--slate);
    background: var(--white);
    transition: all 0.15s ease;
}
.tag-pill:hover {
    background: var(--cloud);
    border-color: var(--ash);
    color: var(--ink);
}
.tag-pill--fw {
    color: var(--accent-blue);
    border-color: rgba(37,99,235,0.2);
    background: rgba(37,99,235,0.04);
}
.tag-pill--lang {
    color: var(--accent-green);
    border-color: rgba(16,185,129,0.2);
    background: rgba(16,185,129,0.04);
}
.tag-pill--dataset {
    color: var(--accent-purple);
    border-color: rgba(139,92,246,0.2);
    background: rgba(139,92,246,0.04);
}
.tag-pill--paper {
    color: var(--accent-cyan);
    border-color: rgba(6,182,212,0.2);
    background: rgba(6,182,212,0.04);
}

/* ============================================================
   QUICK STATS GRID
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    padding: 1.5rem 0;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--fog);
    border-radius: var(--r-lg);
    padding: 1rem 1.25rem;
    text-align: center;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--slate);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
}
.stat-value--green { color: var(--accent-green); }
.stat-value--purple { color: var(--accent-purple); }
.stat-value--blue { color: var(--accent-blue); }

/* ============================================================
   DETAIL CTA BOX
   ============================================================ */
.detail-cta {
    background: linear-gradient(135deg, rgba(245,158,11,0.08) 0%, rgba(217,119,6,0.08) 100%);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--r-xl);
    padding: 1.5rem 2rem;
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.detail-cta-text h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.25rem;
}

.detail-cta-text p {
    font-size: 0.9rem;
    color: var(--slate);
}

.detail-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--white);
    background: linear-gradient(135deg, var(--accent-amber), #d97706);
    border: none;
    border-radius: var(--r-full);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.detail-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245,158,11,0.3);
    color: var(--white);
}

/* ============================================================
   CONTENT LAYOUT (detail page main body + sidebar)
   ============================================================ */
.content-layout {
    display: grid;
    grid-template-columns: 1fr var(--sidebar-w);
    gap: 2.5rem;
    padding: 2rem 0;
    align-items: start;
}

.content-main {
    min-width: 0;
}

.content-section {
    background: var(--white);
    border: 1px solid var(--fog);
    border-radius: var(--r-lg);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.content-section h2 {
    font-family: var(--font-body);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--cloud);
    letter-spacing: -0.01em;
}

.content-section p {
    margin-bottom: 0.85rem;
    line-height: 1.7;
    color: var(--ink-soft);
}

.content-section strong {
    color: var(--ink);
    font-weight: 600;
}

.content-section a {
    color: var(--accent-blue);
    text-decoration: underline;
    text-decoration-color: rgba(37,99,235,0.3);
    text-underline-offset: 2px;
}
.content-section a:hover {
    text-decoration-color: var(--accent-blue);
}

.content-section ul, .content-section ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.content-section li {
    margin-bottom: 0.4rem;
    line-height: 1.6;
    color: var(--ink-soft);
}

.content-section table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    overflow-x: auto;
    display: block;
}

.content-section th {
    background: var(--cloud);
    font-weight: 600;
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid var(--fog);
    color: var(--ink);
    white-space: nowrap;
}

.content-section td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--cloud);
    color: var(--ink-soft);
}

.content-section code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--cloud);
    padding: 0.15rem 0.35rem;
    border-radius: var(--r-sm);
    color: var(--accent-blue);
}

.content-section pre {
    background: var(--ink);
    color: #e5e7eb;
    padding: 1rem 1.25rem;
    border-radius: var(--r-md);
    overflow-x: auto;
    margin: 1rem 0;
    font-size: 0.85rem;
    line-height: 1.5;
}
.content-section pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* ============================================================
   STICKY TOC SIDEBAR
   ============================================================ */
.toc-sidebar {
    position: sticky;
    top: 6rem;
}

.toc-card {
    background: var(--white);
    border: 1px solid var(--fog);
    border-radius: var(--r-lg);
    padding: 1.25rem;
}

.toc-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--slate);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.toc-list {
    list-style: none;
}

.toc-list li {
    margin-bottom: 0.2rem;
}

.toc-list a {
    display: block;
    padding: 0.3rem 0.6rem;
    font-size: 0.82rem;
    color: var(--slate);
    border-radius: var(--r-sm);
    border-left: 2px solid transparent;
    transition: all 0.15s ease;
}
.toc-list a:hover {
    color: var(--ink);
    background: var(--cloud);
}
.toc-list a.active {
    color: var(--accent-blue);
    border-left-color: var(--accent-blue);
    background: rgba(37,99,235,0.04);
    font-weight: 500;
}

/* HuggingFace link card in sidebar */
.hf-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    background: var(--cloud);
    border-radius: var(--r-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink);
    transition: background 0.15s ease;
}
.hf-link:hover {
    background: var(--fog);
    color: var(--ink);
}

/* ============================================================
   RELATED MODELS GRID
   ============================================================ */
.related-section {
    padding: 2rem 0;
    border-top: 1px solid var(--fog);
}

.related-section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 1.25rem;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

/* Reuses .model-card styling */

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--ink);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--white);
    font-size: 1rem;
}
.footer-brand span {
    background: linear-gradient(135deg, var(--grad-start), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.footer-links a {
    color: var(--slate);
    font-size: 0.85rem;
    transition: color 0.15s ease;
}
.footer-links a:hover { color: var(--white); }

.footer-copy {
    color: var(--slate);
    font-size: 0.8rem;
}

/* ============================================================
   NOSCRIPT FALLBACK
   ============================================================ */
.noscript-list {
    column-count: 3;
    column-gap: 2rem;
    padding: 2rem 0;
}
.noscript-list a {
    display: block;
    padding: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--accent-blue);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--slate);
}
.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .content-layout {
        grid-template-columns: 1fr;
    }
    .toc-sidebar {
        display: none;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --card-min: 100%;
        --gap: 1rem;
    }

    .nav {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .filters {
        position: relative;
        top: auto;
        z-index: auto;
        box-shadow: none;
    }

    .filter-toggle {
        display: flex;
    }

    .filter-rows {
        display: none;
        padding-top: 1rem;
    }
    .filter-rows.open {
        display: block;
    }

    .filter-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-label {
        min-width: auto;
        margin-bottom: 0.25rem;
    }

    .results-bar {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .detail-cta {
        flex-direction: column;
        text-align: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .content-section {
        padding: 1.25rem;
    }

    .noscript-list {
        column-count: 1;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .hero-stats {
        gap: 1.25rem;
    }

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

    .pagination {
        gap: 0.2rem;
    }

    .page-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
        min-width: 32px;
    }
}
