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

:root {
    --bg: #0d0a14;
    --bg-surface: #15111f;
    --bg-card: #1c1629;
    --bg-elevated: #241d33;
    --border: #2e2445;
    --border-glow: #4a3870;
    --text: #e0dae8;
    --text-secondary: #9488a8;
    --text-muted: #5e5275;
    --purple: #8b5cf6;
    --purple-bright: #a78bfa;
    --purple-dim: #5b21b6;
    --purple-bg: rgba(139, 92, 246, 0.08);
    --green: #22c55e;
    --red: #ef4444;
    --orange: #f97316;
    --gold: #d4a843;
    --t1: #7c8da6; --t2: #c49a5c; --t3: #7a9a6b;
    --t4: #5b8fb9; --t5: #9b7ec8; --t6: #c97878;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 17px; scroll-behavior: smooth; }
body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Nav ─────────────────────────────────────────── */
nav {
    position: sticky; top: 0; z-index: 100;
    background: rgba(13, 10, 20, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
}
.nav-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; align-items: center; height: 56px; gap: 2rem;
}
.nav-brand {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem; font-weight: 700;
    color: var(--purple-bright);
    letter-spacing: 0.04em;
    text-decoration: none;
}
.nav-links { display: flex; gap: 0.25rem; margin-left: auto; }
.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem; font-weight: 500;
    transition: all 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-card); }
.nav-links a.active { color: var(--purple-bright); background: var(--bg-elevated); }

/* ── Layout ──────────────────────────────────────── */
.page { max-width: 1200px; margin: 0 auto; padding: 2rem; }
.page-title {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem; font-weight: 700;
    color: var(--purple-bright);
    margin-bottom: 0.5rem;
}
.page-subtitle { color: var(--text-secondary); margin-bottom: 2rem; }

/* ── Cards ───────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-glow); }
.card-header {
    padding: 0.9rem 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 0.75rem;
}
.card-header h3 {
    font-size: 0.85rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-secondary);
}
.card-body { padding: 1.2rem; }

/* ── Projects grid ───────────────────────────────── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}
.project-card { cursor: pointer; }
.project-card.expanded { grid-column: 1 / -1; }

.project-top {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 1rem 1.2rem;
}
.project-info { flex: 1; }
.project-name { font-weight: 600; font-size: 1rem; }
.project-meta { font-size: 0.78rem; color: var(--text-muted); }
.project-pct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem; font-weight: 700;
}

/* ── Progress bar ────────────────────────────────── */
.pbar { width: 100%; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.pbar-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.pbar-green .pbar-fill { background: var(--green); }
.pbar-orange .pbar-fill { background: var(--orange); }
.pbar-red .pbar-fill { background: var(--red); }
.pbar-purple .pbar-fill { background: var(--purple); }

/* ── Needs list ──────────────────────────────────── */
.needs-section { padding: 0 1.2rem 1.2rem; }
.needs-tier-header {
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); margin: 0.75rem 0 0.35rem;
    padding-left: 0.25rem;
}
.need-item {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.4rem 0.6rem; border-radius: 5px;
    margin-bottom: 0.2rem;
    background: rgba(139, 92, 246, 0.04);
    border: 1px solid transparent;
    transition: border-color 0.15s;
}
.need-item:hover { border-color: var(--border); }
.need-name { font-weight: 500; flex: 1; font-size: 0.88rem; }
.need-deficit {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700; color: var(--red); font-size: 0.85rem;
}
.need-fraction { font-size: 0.75rem; color: var(--text-muted); }

/* ── Buttons ─────────────────────────────────────── */
.btn {
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-elevated);
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}
.btn:hover { border-color: var(--purple-dim); color: var(--purple-bright); }
.btn-purple {
    background: linear-gradient(135deg, var(--purple-dim), var(--purple));
    color: #fff; border: none; font-weight: 700;
}
.btn-purple:hover { opacity: 0.9; }

/* ── Toolbar ─────────────────────────────────────── */
.toolbar {
    display: flex; align-items: center; gap: 1rem;
    margin-bottom: 1.5rem;
}
.toolbar .status { font-size: 0.8rem; color: var(--text-muted); }

/* ── Tier colors ─────────────────────────────────── */
.tier-bg-0 { background: #6b7280; } .tier-bg-1 { background: #7c8da6; }
.tier-bg-2 { background: #c49a5c; } .tier-bg-3 { background: #7a9a6b; }
.tier-bg-4 { background: #5b8fb9; } .tier-bg-5 { background: #9b7ec8; }
.tier-bg-6 { background: #c97878; } .tier-bg-7 { background: #d4a843; }
.tier-bg-8 { background: #4db8a4; } .tier-bg-9 { background: #b85c9a; }
.tier-bg-10 { background: #e6c84d; }

/* ── Loading ─────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border); border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 700px) {
    html { font-size: 15px; }
    .projects-grid { grid-template-columns: 1fr; }
    .page { padding: 1rem; }
}
