/* ========== Header ========== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
    height: var(--header-height);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: var(--space-sm);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 1.125rem;
    min-width: 0;
    flex-shrink: 1;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 800;
    font-size: 1rem;
    flex-shrink: 0;
}

.logo-text {
    color: var(--color-text);
    line-height: 1.2;
    font-size: 0.875rem;
}

@media (min-width: 640px) {
    .logo-text {
        font-size: 1rem;
    }
}

/* Desktop nav */
.main-nav {
    display: none;
    gap: var(--space-xs);
}

.nav-link {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-link:hover {
    color: var(--color-text);
    background: var(--color-border-light);
}

.nav-link.active {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.lang-toggle {
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.lang-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Hamburger */
.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--color-text);
    border-radius: 1px;
    transition: all var(--transition-fast);
    transform-origin: center;
}

.menu-toggle.open span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.open span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile nav dropdown */
.main-nav.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-surface);
    padding: var(--space-md) var(--space-lg);
    gap: 0;
    z-index: 99;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid var(--color-border);
    animation: slideDown 200ms ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-nav.open .nav-link {
    font-size: 1rem;
    padding: 0.875rem var(--space-md);
    border-radius: var(--radius-sm);
}

.main-nav.open .nav-link:active {
    background: var(--color-border-light);
}

/* Body scroll lock when nav open */
body.nav-open {
    overflow: hidden;
}

/* Mobile nav backdrop */
.nav-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-height);
    background: rgba(0, 0, 0, 0.3);
    z-index: 98;
    animation: fadeIn 200ms ease-out;
}

.nav-backdrop.open {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (min-width: 768px) {
    .main-nav {
        display: flex;
    }
    .menu-toggle {
        display: none;
    }
    .header-actions {
        gap: var(--space-md);
    }
    .logo-text {
        font-size: 1.125rem;
    }
}

/* On very small screens, hide logo text */
@media (max-width: 374px) {
    .logo-text {
        display: none;
    }
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--color-primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-accent {
    background: var(--color-accent);
    color: white;
}

.btn-accent:hover {
    background: var(--color-accent-dark);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

@media (max-width: 639px) {
    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: 0.125rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-historical {
    background: #f1f5f9;
    color: #475569;
}

.badge-category {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
}

/* Hardware badge — uses a neutral slate base, with colored
   variants for CPU-only, GPU-only, and the combined label. */
.badge-hardware {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

.badge-hardware.hw-gpu,
.chip-hardware.hw-gpu {
    background: #ede9fe;
    color: #5b21b6;
    border-color: #ddd6fe;
}

.badge-hardware.hw-cpu-gpu,
.chip-hardware.hw-cpu-gpu {
    background: #e0f2fe;
    color: #075985;
    border-color: #bae6fd;
}

/* ========== Project Cards ========== */
.project-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all var(--transition-base);
    text-decoration: none;
    color: inherit;
}

.project-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

@media (max-width: 639px) {
    .project-card:hover {
        transform: none;
    }
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-icon {
    font-size: 2rem;
    line-height: 1;
}

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.card-category {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

.card-summary {
    font-size: 0.9375rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    flex: 1;
    margin-bottom: var(--space-md);
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}

.card-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
}

.project-card:hover .card-link {
    text-decoration: underline;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
}

/* ========== Footer ========== */
.site-footer {
    background: var(--color-text);
    color: #cbd5e1;
    padding: var(--space-2xl) 0 var(--space-lg);
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 1px solid #334155;
}

.footer-brand .footer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.footer-brand .logo-icon {
    background: var(--color-primary);
}

.footer-brand .logo-text {
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.footer-tagline {
    font-size: 0.875rem;
    color: #94a3b8;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-links a {
    font-size: 0.9375rem;
    transition: color var(--transition-fast);
}

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

.footer-bottom {
    padding-top: var(--space-lg);
    font-size: 0.8125rem;
    color: #64748b;
}

.footer-bottom a {
    color: #94a3b8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.footer-bottom a:hover {
    color: white;
}

.footer-no-tracking {
    margin-top: var(--space-sm);
    font-size: 0.75rem;
    color: #475569;
    cursor: help;
}

@media (min-width: 768px) {
    .footer-inner {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }
    .footer-links {
        justify-content: flex-end;
    }
    .site-footer {
        padding: var(--space-3xl) 0 var(--space-xl);
    }
}

/* ========== Platform cards (BOINC, World Community Grid) ========== */
.project-card--platform {
    position: relative;
    background: linear-gradient(180deg, #fffbeb 0%, #ffffff 55%);
    border-color: #fcd34d;
    box-shadow: 0 1px 2px rgba(180, 120, 0, 0.08), 0 4px 12px rgba(245, 158, 11, 0.08);
}

.project-card--platform:hover {
    border-color: var(--color-accent);
    box-shadow: 0 4px 10px rgba(180, 120, 0, 0.12), 0 10px 24px rgba(245, 158, 11, 0.16);
    transform: translateY(-1px);
}

.platform-ribbon {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent) 0%, #f97316 100%);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    pointer-events: none;
}

.card-badges {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.badge-platform {
    background: var(--color-accent);
    color: #78350f;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.6875rem;
}

.card-platform-note {
    /* Sits between .card-category and .card-summary; category already
       carries margin-bottom, so only the bottom side needs spacing. */
    margin-top: 0;
    margin-bottom: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-accent-light);
    border-left: 3px solid var(--color-accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.8125rem;
    color: #78350f;
    line-height: 1.45;
}

/* Tighten gap between category and platform-note so the note reads as a
   tagline rather than a detached chip. */
.card-category:has(+ .card-platform-note) {
    margin-bottom: var(--space-sm);
}
