/* style.css - xpsystems opensource.xpsystems.eu */

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

/* ── Tokens ─────────────────────────────── */
:root {
    --bg:           #0a0a0f;
    --bg-alt:       #0d0d14;
    --card:         #13131a;
    --card-hover:   #161620;
    --border:       #1e1e2a;
    --border-hover: #2e2e42;
    --text:         #e8e8f0;
    --text-muted:   #7878a0;
    --text-dim:     #4a4a6a;
    --accent:       #4f8ef7;
    --accent-dim:   #2a5ab0;
    --purple:       #a78bfa;
    --purple-dim:   #6d28d9;
    --green:        #34d399;
    --footer-bg:    #070709;
    --nav-height:   64px;
    --radius:       12px;
    --radius-sm:    8px;
    --radius-xs:    5px;
    --transition:   0.22s ease;
    --mono:         'JetBrains Mono', 'Fira Code', monospace;
}

[data-theme="light"] {
    --bg:           #f5f5f8;
    --bg-alt:       #ebebf0;
    --card:         #ffffff;
    --card-hover:   #f9f9fc;
    --border:       #dcdce8;
    --border-hover: #b8b8d0;
    --text:         #111118;
    --text-muted:   #55556a;
    --text-dim:     #9999b8;
    --accent:       #2e6ee6;
    --accent-dim:   #b8d0f8;
    --purple:       #7c3aed;
    --purple-dim:   #ddd6fe;
    --green:        #059669;
    --footer-bg:    #e2e2ea;
}

html { scroll-behavior: smooth; font-size: 16px; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}
a { color: inherit; text-decoration: none; }
.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); }

/* ── Nav ─────────────────────────────────── */
.nav-header {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    height: var(--nav-height);
    background-color: rgba(10, 10, 15, 0.88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
[data-theme="light"] .nav-header { background-color: rgba(245, 245, 248, 0.88); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; padding: 0 24px; max-width: 1160px; margin: 0 auto; }
.nav-logo { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.03em; transition: color var(--transition); }
.nav-logo:hover { color: var(--accent); }
.nav-links { display: none; align-items: center; gap: 4px; }
.nav-link { font-size: 0.875rem; font-weight: 500; color: var(--text-muted); padding: 6px 12px; border-radius: var(--radius-sm); transition: all var(--transition); }
.nav-link:hover { color: var(--text); background-color: var(--card); }
.nav-link.active { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 12px; }

/* Mobile Nav */
.nav-hamburger { display: flex; width: 40px; height: 40px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: none; color: var(--text); cursor: pointer; }
.nav-hamburger svg { width: 18px; height: 18px; }
.icon-close { display: none; }
.nav-hamburger.open .icon-hamburger { display: none; }
.nav-hamburger.open .icon-close { display: block; }
.nav-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 98; }
.nav-overlay.active { display: block; }

/* ── Hero ────────────────────────────────── */
.hero {
    position: relative;
    padding: calc(var(--nav-height) + 80px) 0 80px;
    text-align: center;
    overflow: hidden;
}

.hero-grid-bg {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(79, 142, 247, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 142, 247, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 100%);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--mono);
    color: var(--accent);
    background: rgba(79, 142, 247, 0.08);
    border: 1px solid rgba(79, 142, 247, 0.2);
    border-radius: 999px;
    padding: 5px 12px;
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

.hero-title {
    font-size: clamp(2.8rem, 8vw, 5rem);
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.05;
    margin-bottom: 20px;
}
.hero-title-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-description {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

/* Buttons */
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-bottom: 48px; }
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.875rem; font-weight: 600;
    padding: 10px 20px; border-radius: var(--radius-sm);
    transition: all var(--transition); cursor: pointer;
    border: none; white-space: nowrap;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: #3d7de8; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(79,142,247,0.25); }
.btn-ghost {
    background: var(--card);
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hover); background: var(--card-hover); transform: translateY(-1px); }

/* Hero Stats */
.hero-stats {
    display: inline-flex;
    align-items: center;
    gap: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 32px;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 20px;
}
.stat-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 0 28px; }
.stat-num {
    font-size: 1.75rem; font-weight: 800;
    font-family: var(--mono);
    letter-spacing: -0.04em;
    color: var(--text);
    line-height: 1;
}
.stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.stat-divider { width: 1px; height: 40px; background: var(--border); flex-shrink: 0; }

/* ── Dividers ────────────────────────────── */
.section-divider { display: block; line-height: 0; margin-top: -80px; height: 80px; pointer-events: none; }
.section-divider svg { width: 100%; height: 100%; overflow: visible; }
.divider-fill-bg     { fill: var(--bg);        transition: fill 0.3s ease; }
.divider-fill-alt    { fill: var(--bg-alt);     transition: fill 0.3s ease; }
.divider-fill-footer { fill: var(--footer-bg);  transition: fill 0.3s ease; }

/* ── Section Shared ──────────────────────── */
.oss-section { padding: 100px 0 80px; }
.section-header { text-align: center; margin-bottom: 48px; }
.section-title { font-size: clamp(1.75rem, 4vw, 2.25rem); font-weight: 800; letter-spacing: -0.04em; margin-bottom: 10px; }
.section-sub { font-size: 0.9375rem; color: var(--text-muted); max-width: 480px; margin: 0 auto; }

/* ── Org Cards ───────────────────────────── */
.org-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.org-card {
    display: flex; flex-direction: column; gap: 20px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 28px;
    transition: all var(--transition); cursor: pointer;
    position: relative; overflow: hidden;
}
.org-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(79,142,247,0.04) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}
.org-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.org-card:hover::before { opacity: 1; }
.org-card-top { display: flex; align-items: center; gap: 16px; }
.org-avatar { width: 56px; height: 56px; border-radius: 12px; overflow: hidden; flex-shrink: 0; background: var(--border); }
.org-avatar img { width: 100%; height: 100%; object-fit: cover; }
.org-avatar-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-dim); }
.org-name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.org-name { font-size: 1rem; font-weight: 700; letter-spacing: -0.02em; }
.org-type-badge {
    font-size: 0.68rem; font-weight: 600; font-family: var(--mono);
    color: var(--text-dim); background: var(--bg);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 1px 7px; white-space: nowrap;
}
.org-desc { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.5; }
.org-card-stats { display: flex; gap: 16px; }
.org-stat { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--text-muted); font-family: var(--mono); }
.org-stat-num { font-weight: 600; color: var(--text); }
.org-link-hint {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.8125rem; font-weight: 600; color: var(--accent);
    margin-top: auto;
}

/* ── Repo Table ──────────────────────────── */
.repo-controls {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.repo-search-wrap {
    position: relative; flex: 1; min-width: 200px; max-width: 320px;
}
.repo-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.repo-search {
    width: 100%; padding: 9px 12px 9px 36px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text);
    font-family: inherit; font-size: 0.875rem;
    transition: border-color var(--transition);
    outline: none;
}
.repo-search:focus { border-color: var(--accent); }
.repo-search::placeholder { color: var(--text-dim); }

.repo-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-btn {
    padding: 7px 14px; background: var(--card); border: 1px solid var(--border);
    border-radius: 999px; font-size: 0.8125rem; font-weight: 500;
    color: var(--text-muted); cursor: pointer; transition: all var(--transition);
    font-family: inherit;
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text); }
.filter-btn.active { background: rgba(79,142,247,0.1); border-color: rgba(79,142,247,0.4); color: var(--accent); }

.repo-table-wrap {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; overflow-x: auto;
}
.repo-table {
    width: 100%; border-collapse: collapse; font-size: 0.875rem;
    min-width: 680px;
}
.repo-table thead {
    border-bottom: 1px solid var(--border);
    background: rgba(255,255,255,0.015);
}
.repo-table th {
    padding: 12px 16px; text-align: left; font-size: 0.75rem;
    font-weight: 600; color: var(--text-muted); white-space: nowrap;
    user-select: none;
}
.repo-table th.sortable { cursor: pointer; transition: color var(--transition); }
.repo-table th.sortable:hover { color: var(--text); }
.repo-table th.sort-asc .sort-icon,
.repo-table th.sort-desc .sort-icon { color: var(--accent); }
.sort-icon { display: inline-block; margin-left: 4px; vertical-align: middle; color: var(--text-dim); transition: color var(--transition); }

.repo-table td { padding: 13px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.repo-table tbody tr { transition: background-color 0.15s ease; }
.repo-table tbody tr:hover { background: rgba(255,255,255,0.02); }
[data-theme="light"] .repo-table tbody tr:hover { background: rgba(0,0,0,0.02); }

.col-name { min-width: 200px; }
.col-org  { min-width: 130px; }
.col-lang { min-width: 110px; }
.col-stars, .col-forks { min-width: 80px; }
.col-updated { min-width: 110px; }
.col-link { min-width: 44px; text-align: right; }

.repo-name-link { font-weight: 600; color: var(--text); transition: color var(--transition); display: flex; align-items: center; gap: 8px; }
.repo-name-link:hover { color: var(--accent); }
.repo-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.repo-fork-badge { font-size: 0.7rem; font-family: var(--mono); color: var(--text-dim); background: var(--bg-alt); border: 1px solid var(--border); border-radius: 999px; padding: 1px 6px; white-space: nowrap; }

.org-tag {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.75rem; font-weight: 600; font-family: var(--mono);
    padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.org-tag.xpsystems     { background: rgba(79,142,247,0.1); color: var(--accent); border: 1px solid rgba(79,142,247,0.2); }
.org-tag.xpsystems-ai  { background: rgba(167,139,250,0.1); color: var(--purple); border: 1px solid rgba(167,139,250,0.2); }

.lang-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex-shrink: 0; }
.lang-label { display: flex; align-items: center; font-size: 0.8125rem; color: var(--text-muted); white-space: nowrap; }

.star-count, .fork-count {
    display: inline-flex; align-items: center; gap: 5px;
    font-family: var(--mono); font-size: 0.8125rem; color: var(--text-muted);
}

.repo-link-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: var(--radius-xs);
    color: var(--text-dim); transition: all var(--transition);
    border: 1px solid transparent;
}
.repo-link-btn:hover { color: var(--accent); background: rgba(79,142,247,0.08); border-color: rgba(79,142,247,0.2); }

.repo-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px 24px; color: var(--text-muted); font-size: 0.875rem; }
.loading-spinner {
    width: 20px; height: 20px; border: 2px solid var(--border);
    border-top-color: var(--accent); border-radius: 50%;
    animation: spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.repo-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 12px; padding: 60px 24px; color: var(--text-dim); font-size: 0.875rem;
}

.repo-meta { font-size: 0.78rem; color: var(--text-dim); font-family: var(--mono); margin-top: 10px; text-align: right; }

/* ── Team ────────────────────────────────── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; max-width: 760px; margin: 0 auto; }
.team-card {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: all var(--transition);
    display: flex; flex-direction: column;
}
.team-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,0.25); }

.team-avatar-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;   /* true square regardless of card width */
    background: var(--bg);
    overflow: hidden;
    flex-shrink: 0;
}
.team-avatar {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
    transition: transform 0.4s ease;
}
.team-card:hover .team-avatar { transform: scale(1.04); }

.team-info { padding: 20px 24px 12px; flex: 1; }
.team-name { font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 2px; }
.team-role { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: 12px; }
.team-github {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.8125rem; font-family: var(--mono); font-weight: 600;
    color: var(--text-dim); transition: color var(--transition);
}
.team-github:hover { color: var(--accent); }

.team-gh-stats {
    display: flex; border-top: 1px solid var(--border); padding: 16px 24px;
    gap: 24px;
}
.gh-stat-item { display: flex; flex-direction: column; gap: 2px; }
.gh-stat-num { font-size: 1.125rem; font-weight: 700; font-family: var(--mono); letter-spacing: -0.04em; }
.gh-stat-label { font-size: 0.73rem; color: var(--text-muted); font-weight: 500; }

/* ── Footer ──────────────────────────────── */
.site-footer { background-color: var(--footer-bg); padding: 40px 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.footer-brand { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.footer-logo { font-size: 1.125rem; font-weight: 800; }
.footer-copy { font-size: 0.8125rem; color: var(--text-dim); }
.footer-version { font-size: 0.75rem; color: var(--text-dim); font-family: var(--mono); background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; margin-top: 4px; }
.footer-gh-link {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.8125rem; font-weight: 600; font-family: var(--mono);
    color: var(--text-muted);
    background: var(--card); border: 1px solid var(--border);
    border-radius: 999px; padding: 6px 14px;
    transition: all var(--transition);
}
.footer-gh-link:hover { color: var(--accent); border-color: rgba(79,142,247,0.4); background: rgba(79,142,247,0.06); }

/* ── Theme Toggle ────────────────────────── */
.theme-toggle { display: inline-flex; background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 999px; background: none; border: none; cursor: pointer; color: var(--text-dim); transition: all var(--transition); }
.theme-btn svg { width: 14px; height: 14px; }
.theme-btn:hover { color: var(--text); background-color: var(--border); }
.theme-btn.active { color: var(--accent); background-color: rgba(79, 142, 247, 0.12); }

/* ── Utilities ───────────────────────────── */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.55s ease, transform 0.55s ease; transition-delay: var(--delay, 0ms); }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── Responsive ──────────────────────────── */
@media (min-width: 768px) {
    .nav-hamburger { display: none; }
    .nav-links { display: flex; }
    .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
    .footer-brand { align-items: flex-start; }
    .footer-right { align-items: flex-end; }
}

@media (max-width: 767px) {
    .stat-item { padding: 0 16px; }
    .hero-stats { padding: 16px 12px; }
    .stat-divider { display: none; }
    .oss-section { padding: 70px 0 50px; }
    .repo-controls { flex-direction: column; align-items: stretch; }
    .repo-search-wrap { max-width: 100%; }
    .nav-links {
        display: flex; flex-direction: column;
        position: fixed; top: var(--nav-height); right: 0; bottom: 0;
        width: 280px; background-color: #0f0f17;
        border-left: 1px solid var(--border);
        padding: 24px; transform: translateX(100%);
        transition: transform 0.28s ease; z-index: 99;
    }
    [data-theme="light"] .nav-links { background-color: #f0f0f5; }
    .nav-links.open { transform: translateX(0); }
    .nav-link { width: 100%; padding: 10px 0; }
}

/* ── Theme Transition ────────────────────── */
html.is-switching-theme *,
html.is-switching-theme *::before,
html.is-switching-theme *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, fill 0.3s ease !important;
}